Path: utzoo!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!ingr!b11!abashian From: abashian@b11.ingr.com (Pete Abashian) Newsgroups: comp.lang.c Subject: reverse asctime()? EEEK! Keywords: dates Message-ID: <5178@b11.ingr.com> Date: 2 Jun 89 03:43:50 GMT Distribution: usa Organization: Intergraph Corp. Huntsville, AL Lines: 31 Yikes! For fear that I just fell off the banana boat yesterday, prepare ye all your flame throwers... We all (theoretically) know the function of asctime(); right? ie: long ltime; struct tm *timedef; char *p; ltime = atol(pointer to number of seconds since epoch); timedef = localtime(<ime); p = asctime(timedef); return(p); Where p is now a pointer to a string similar to Jun 01, 1989 22:25:00 EST... Now the problem. I need to be able to take an ascii string and convert it back to the internal storage - number of seconds since epoch. The task would normally entail some simple mathematics to incorporate leap [gag] years, etc... But what about the sticky user(s) that want to be able to input virtually any valid combination of dates/times? 12MAY89, 12-MAY-89, May 12, 1989....etc. For the life of me I cannot remember EVER seeing an include file or archive with a reference to such a routine. Did I just fall off the boat, or what? _______________________________________________________________________________ | Jim Kazek, Intergraph Corporation, "It's my bosses opionion that I have none"| | ingr!e911!jimk (205) 464-8690 || "If you have a Studebaker, I've got a DEC Rainbow for the trunk..." |+______________________________________________________________________________+