Path: utzoo!utgpu!water!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!uflorida!novavax!hcx1!hcx2!danr From: danr@hcx2.SSD.HARRIS.COM Newsgroups: comp.lang.c Subject: Re: Seconds from 19xx to Date (and visa Message-ID: <44100014@hcx2> Date: 5 Oct 88 13:15:00 GMT References: <5522@hoptoad.uucp> Lines: 33 Nf-ID: #R:hoptoad.uucp:5522:hcx2:44100014:000:1135 Nf-From: hcx2.SSD.HARRIS.COM!danr Oct 5 09:15:00 1988 >/* Written 10:18 pm Oct 3, 1988 by pozar@hoptoad.UUCP in hcx2:comp.lang.c */ [edited slightly without permission] >/* ---------- "Seconds from 19xx to Date (and visa" ---------- */ > > Does anyone have a routine to change back and forth between >seconds from 19xx to a Year, Month, Day sort of Date? > Thanks > Tim >/* End of text from hcx2:comp.lang.c */ You might want to look at the man page for ctime(), if you have access to one. it is in the standard library, so you don't need to write anything bu the function call. char *ctime (clock) long *clock; where clock is a pointer to a long integer containing a number of seconds since 00:00:00 GMT, January 1, 1970 (when time began...) CAVEAT: The return value is to a static buffer, so something like printf (" %s %s ", ctime (&time1), ctime (&time2)); will print out ctime (&time[12]) for both (depending on the order of evaluation of parameters, should some compiler do it backwards). If you need to do this, copy one of the ctime() return values to another string before calling ctime() again. Hope this will do!!! -danr@hcx1.ssd.harris.com