rokicki@rocky.UUCP (03/21/87)
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) ;
}