Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watnot!watmath!clyde!rutgers!mit-eddie!genrad!decvax!decwrl!labrea!rocky!rokicki From: rokicki@rocky.UUCP Newsgroups: comp.sys.amiga Subject: Date from TimeStamp Message-ID: <206@rocky.STANFORD.EDU> Date: Fri, 20-Mar-87 21:47:33 EST Article-I.D.: rocky.206 Posted: Fri Mar 20 21:47:33 1987 Date-Received: Sun, 22-Mar-87 20:30:16 EST Organization: Stanford University Computer Science Department Lines: 35 Someone asked how to get the month and day information from the DateStamp. Here's a program I cooked up, what, a year ago? to do exactly that; this is its second posting to the net. Note that the original program would have broken in 2006 if compiled with short ints on Manx; this version will not break until March 1, 2100. This and many other useful programs can be found in the Programmer's Guide to the Amiga by Rhobert A. Peck. :-) -tom --- char *months[] = {"", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"} ; main() { long v[3] ; DateStamp(v) ; ShowDate(v) ; } ShowDate(v) long *v ; { long n ; int m, d, y ; n = v[0] - 2251 ; y = (4 * n + 3) / 1461 ; n -= 1461 * (long)y / 4 ; y += 1984 ; m = (5 * n + 2) / 153 ; d = n - (153 * m + 2) / 5 + 1 ; m += 3 ; if (m > 12) { y++ ; m -= 12 ; } printf("%s %d, %d\n", months[m], d, y) ; }