Zeller

Oscar van Vlijmen o.van.vlijmen at tip.nl
Wed Oct 4 10:11:17 UTC 2000


Allow me to give a couple of key sources for Zeller's algorithm to find the
day of the week:

nr = (k + floor((13*m-1)/5) + D + floor(D/4) + floor(C/4) - 2*C) mod 7

k: day of the month.
m: month number shifted by -2; March = 1, April = 2, January = 11 of year-1,
February = 12 of year-1.
D: year mod 100, or the last two digits of the year.
C: year div 100, or the century; at the moment C = 20.

nr is an integer from 0 to 6. 0 corresponds to Sunday, 1 to Monday etcetera.

Source: Ask Dr. Math: FAQ, 'The Calendar and the Days of the Week'
http://forum.swarthmore.edu/dr.math/faq/faq.calendar.html


Other source: 'Weekday -- from Eric Weisstein's Treasure Trove of
Astronomy', Eric W. Weisstein and Wolfram Research
http://www.treasure-troves.com/astro/Weekday.html


Zeller's formula works only for Gregorian dates.
Astronomers first convert any date (Julian, Gregorian) to the Julian date
number. This number mod 7 gives the day of the week; 0 = Sunday, 1 = Monday,
etc.
Source: Astronomical algorithms, J. Meeus, Willmann-Bell, Chapter 7.

Oscar van Vlijmen
2000-10-04






More information about the tz mailing list