How to work out the day of the week
This calculator shows Zeller's congruence, a formula from 1882 that gives the weekday for any Gregorian date:
- q is the day of the month.
- m is the month, with March = 3 up to December = 12, and January and February counted as months 13 and 14 of the year before.
- K is the year within the century (year mod 100) and J is the century (⌊year ÷ 100⌋), using that adjusted year.
- h gives the day: 0 = Saturday, 1 = Sunday, 2 = Monday, … 6 = Friday.
Worked example: July 4, 1776
q = 4, m = 7, K = 76, J = 17.
= (4 + 20 + 76 + 19 + 4 + 85) mod 7 = 208 mod 7 = 5 → Thursday
Why the calendar repeats
A common year is 52 weeks and 1 day, so each date moves one weekday later the next year, or two after February 29. The Gregorian calendar repeats exactly every 400 years (146,097 days, which is exactly 20,871 weeks), so January 1, 2000 and January 1, 2400 are both Saturdays.
Limitations
- Old dates. The Gregorian calendar started on October 15, 1582 (Thursday, October 4 in the old Julian calendar was followed by Friday, October 15). Britain and its American colonies switched in 1752. Dates before the switch are often written in the Julian calendar. For those, the calculator also shows the weekday if the date is a Julian one.
- Earlier dates here use the Gregorian calendar extended backwards (the "proleptic" Gregorian calendar, as in ISO 8601), so they're consistent but may not match a historical document.
Sources
- U.S. Naval Observatory: Introduction to calendars (Gregorian leap-year rule)
- ISO 8601 date and time format