![]() |
VOOZH | about |
Zeller's congruence is an algorithm devised by Christian Zeller to calculate the day of the week for any Julian or Gregorian calendar date. It can be considered to be based on the conversion between Julian's day and the calendar date.
It is an algorithm to find the day of the week for any date.
For the Gregorian calendar it is:
For the Julian calendar it is:
where,
NOTE: In this algorithm January and February are
counted as months 13 and 14 of the previous
year.E.g. if it is 2 February 2010, the
algorithm counts the date as the second day
of the fourteenth month of 2009 (02/14/2009
in DD/MM/YYYY format)
For an ISO week date Day-of-Week d (1 = Monday to 7 = Sunday), use
d = ((h+5)%7) + 1
Sunday
Time Complexity: O(1)
Auxiliary Space: O(1)
Another variation of Zeller's Congruence formula:
Friday