Finding the weekday with Zeller’s congruence
Christian Zeller, a German mathematician, published a formula in the 1880s that turns a calendar date straight into a weekday using nothing but whole-number division. For the Gregorian calendar it reads:
h = ( q + ⌊13 × (m + 1) ÷ 5⌋ + K + ⌊K ÷ 4⌋ + ⌊J ÷ 4⌋ + 5 × J ) mod 7
Here q is the day of the month and m is the month, with one twist: January and February are counted as months 13 and 14 of the previous year, so that the leap day falls at the very end of the counting year. K is the last two digits of that (possibly adjusted) year and J is the rest of it, the century part. The brackets ⌊ ⌋ mean “round down to a whole number” and “mod 7” means the remainder after dividing by 7. The answer h is a code: 0 is Saturday, 1 Sunday, 2 Monday, 3 Tuesday, 4 Wednesday, 5 Thursday and 6 Friday.
Each term has a job. The month term ⌊13 × (m + 1) ÷ 5⌋ reproduces the uneven pattern of 30-day and 31-day months. K + ⌊K ÷ 4⌋ moves the weekday on by one for each year and one more for each leap year. ⌊J ÷ 4⌋ + 5 × J handles the century rule, under which 1900 was not a leap year and 2000 was.
Worked example: 25 December 2026
- Set up. q = 25 and m = 12. December is not January or February, so the year stays 2026: K = 26 and J = 20.
- Month term. 13 × (12 + 1) ÷ 5 = 33.8, rounded down to 33.
- Year terms. ⌊26 ÷ 4⌋ = 6, ⌊20 ÷ 4⌋ = 5 and 5 × 20 = 100.
- Add up. 25 + 33 + 26 + 6 + 5 + 100 = 195.
- Remainder. 195 = 27 × 7 + 6, so h = 6, which is Friday.
A January date shows the twist. For 1 January 2000, use month 13 of 1999: q = 1, m = 13, K = 99, J = 19. The terms are 1 + 36 + 99 + 24 + 4 + 95 = 259, and 259 is exactly 37 × 7, so h = 0: a Saturday. Forgetting to step the year back is the most common slip with this formula.
The doomsday method, for doing it in your head
John Conway’s doomsday method rests on one observation: in any year, a set of easy-to-remember dates all share a weekday, called that year’s doomsday. They are 4 April, 6 June, 8 August, 10 October and 12 December (4/4, 6/6, 8/8, 10/10, 12/12), plus 9 May, 5 September, 11 July and 7 November, 14 March, the last day of February, and 3 January (4 January in a leap year).
Doomsday of the year = ( century anchor + a + b + ⌊b ÷ 4⌋ ) mod 7
Write the last two digits of the year as 12 × a + b, with b less than 12. The century anchor is Friday for the 1800s, Wednesday for the 1900s, Tuesday for the 2000s and Sunday for the 2100s, repeating every 400 years. For 2026: 26 = 2 × 12 + 2, so a = 2, b = 2 and ⌊b ÷ 4⌋ = 0. Tuesday plus 4 days is Saturday. Then 12 December 2026 is a Saturday, and 25 December is 13 days later. Thirteen days is one week and 6 days, and Saturday plus 6 is Friday, the same answer as Zeller.
When the same date lands on the same weekday again
An ordinary year is 52 weeks and 1 day long, so a date moves forward one weekday each year, and two when a 29 February falls in between. While leap years arrive every four years, that pattern brings a date back to the same weekday after gaps of 5, 6 or 11 years, and the whole calendar repeats every 28 years. Christmas Day is a Friday in 2015, 2020, 2026, 2037, 2043 and 2048. A 29 February is the exception, because it only exists in leap years: 29 February 2024 was a Thursday, and the Thursdays before and after it are 1996 and 2052, 28 years each way.
The 28-year rhythm breaks at century years that are not leap years, such as 2100. The full Gregorian calendar repeats exactly every 400 years, because 400 years contain 97 leap days and 400 × 365 + 97 = 146,097 days, which is exactly 20,871 weeks. As 400 years hold 4,800 months, a number not divisible by 7, the weekdays cannot be shared out evenly. One known result: across a 400-year cycle the 13th of the month is a Friday 688 times, more than any other weekday, and a Thursday or a Saturday only 684 times.
Reading the other figures
- Day of the year counts from 1 January as day 1. 25 December 2026 is day 359 of 365, with 6 days left.
- ISO week numbers follow ISO 8601: weeks run Monday to Sunday and week 1 is the one that contains the year’s first Thursday. Days at the edge of a year can therefore belong to the neighbouring year’s week. Monday 29 December 2025 is in week 1 of 2026.
- Leap years are years divisible by 4, except century years, which must be divisible by 400. So 2024 and 2000 are leap years, and 1900, 2026 and 2100 are not.
- Old dates need care. This page applies today’s Gregorian calendar to every year, which historians call the proleptic Gregorian calendar. The calendar began on Friday 15 October 1582 in the countries that adopted it first, and Britain and its colonies did not change until September 1752. A date written down before the change in a given country was recorded on the Julian calendar, and its weekday at the time will not match the result here unless you first convert the date.
Related calculators
- Date calculator for the days between two dates
- Age calculator
- Time duration calculator
- Time zone calculator