Day of week routine
Felix Lee
flee at shire.cs.psu.edu
Tue May 23 09:20:00 AEST 1989
In article <322 at xdos.UUCP>,
doug at xdos.UUCP (Doug Merritt) writes:
>Try this:
> ((year * 1.25) + (day-of-the-year) + constant) modulo 7
Using a strict interpretation of (day-of-the-year), you should use
(year + (year-1)/4) instead of (year * 1.25).
For the Gregorian calendar, try this instead:
year + (year-1)/4 - (year-1)/100 + (year-1)/400.
Note that not all countries adopted the Gregorian calendar at the
same time. (Japan was quite late, something like 19th century?)
--
Felix Lee flee at shire.cs.psu.edu *!psuvax1!shire!flee
More information about the Comp.lang.c
mailing list