Request for simple date routines.

Darren Stone stone at mars.mpr.ca
Wed Apr 10 09:42:55 AEST 1991


Hi.  Just a simple request I hope somebody can
easily pull out of their toolbox...

(1)
I'd like a function which, given a date, returns
0..6 representing the day of the week of the date.

(2)
I'd also like a function which, given 2 dates,
returns the number of days between them.

I really don't care at all about efficiency, but
they must work absolutely reliably for +/- several
hundred years (taking into account the leap-year
rules).  Actually, what are the leap year rules?
Something about evenly divisible by 4, except
not by 100, except by 400?

Thanx in advance.

- Darren -



More information about the Comp.lang.c mailing list