Zeller's Congruence
Finds the day of the week for any Gregorian date.
Formula
Variables
Example
For 2000-01-01 the formula returns h = 7 ⇒ Saturday
How it works
Zeller’s Congruence is a modular arithmetic shortcut that turns a calendar date into a weekday number by counting how many days the date is offset from a fixed pattern of 7-day cycles. The month is re-encoded so that March starts the year, which makes leap-day handling much cleaner because February is treated as the last month of the year. The extra floor terms account for the extra day every 4 years, while the century terms correct for the fact that Gregorian leap years are skipped on most century years unless divisible by 400.
When to use it
Use it when you need the weekday for a Gregorian date without consulting a calendar, especially in programming, puzzle solving, historical date checks, or manual verification. It is most useful for dates after the Gregorian reform and for tasks where exact weekday computation matters.
Worked example, step by step
Find the day of the week for 2024-11-05. q = 5 m = 11 (November) K = 24 (year of century from 2024) J = 20 (century from 2024) Compute each part: ⌊13(m+1)/5⌋ = ⌊13(12)/5⌋ = ⌊156/5⌋ = 31 ⌊K/4⌋ = ⌊24/4⌋ = 6 ⌊J/4⌋ = ⌊20/4⌋ = 5 5J = 5×20 = 100 Substitute into the formula: h = (5 + 31 + 24 + 6 + 5 + 100) mod 7 h = 171 mod 7 h = 3 Interpret the result: 0 = Saturday, 1 = Sunday, 2 = Monday, 3 = Tuesday So 2024-11-05 was a Tuesday.
Common mistakes to avoid
- Using the ordinary month number for January and February instead of treating them as months 13 and 14 of the previous year
- Forgetting to split the year into K and J correctly, which changes the century adjustment terms
- Misreading the output mapping for h, since 0 corresponds to Saturday rather than Sunday
Did You Know?
Christian Zeller published this in 1882; January and February count as months 13 and 14 of the previous year.
Share this formula
More in Time & Calendar
View allLeap Year Rule
BasicTests whether a Gregorian year has 366 days.
Clock Hand Angle
BasicAngle between the hour and minute hands of an analog clock.
Day of the Week from a Birthdate
IntermediateGauss's weekday formula — find which day of the week any birthdate fell on.
Julian Day Number
AdvancedContinuous day count used by astronomers to compare dates.
Days Between Two Dates
IntermediateNumber of days separating two calendar dates.
Age in Years
BasicWhole years elapsed since a birth date.