display | more...
This algorithm, devised by Christian Zeller, allows one to calculate day of the week given a date since the Gregorian Calendar was adopted in 1582. Zeller's Congruence was first published in Acta Mathmatica Number 9, 1886.

Note the awkward numbering system for month -- Michael Keith's C function (presented in 'day of the week') uses a more common representation.

d: day (d=1..31)
m: month (beginning with 3=March, January and February are to be considered months 13 and 14 of the previous year)
Y: year (last two digits)
C: century (really, the first two digits of a four-digit year)
D: day of the week (0=Saturday, 1=Sunday, ... 6=Friday)

D = d + (((m+1)*26)/10 + Y + Y/4 + C/4 - 2*C + 49) mod 7
Using September 1, 2000 as an example:

d=19
m=4
Y=01
C=20

D = (19) + ((((4)+1)*26)/10 + (01) + (01)/4 + (20)/4 - 2*(20) + 49) mod 7
D = 5 (Thursday)

Log in or register to write something here or to contact authors.