The Doomsday Algorithm


Calculating the day of the week given the date

  1. How many times does 12 fit into the last two digits of the year number?
  2. What’s the remainder from calculation one?
  3. How many times does 4 fit into the result of calculation two?
  4. What is this century’s anchor day?
  5. Add up all these four results
  6. Reduce mod 7, this gives the day number of the doomsday of each year

Information to memorise

Doomsdays

All of these days occur on the same day of the year every year.

Month/DayMneumonic
1/3 (common years), 1/4 (leap years)It’s the 3rd three out of four years, and the 4th otherwise
2/28 (common years), 2/29 (leap years)Last day
3/14Pi day
4/4even/even
5/9Working 5-9 at the 11-7
6/6even/even
11/7Working 5-9 at the 11-7
8/8even/even
9/5Working 9-5 at the 7-11
10/10even/even
11/7Working 9-5 at the 7-11

Day numbers

How to assign numbers to each day.

Day nameNumber
Monday0
Tuesday1
Wednesday2
Thursday3
Friday4
Saturday5
Sunday6

Anchor days

Used in the calculation.

CenturyDay nameNumber
1700-1799…Sunday (end of cycle)6
1800-1899Friday (start of cycle)4
1900-1999Wednesday2
2000-2099Tuesday1
2100-2199Sunday (end of cycle)6
2200-2299…Friday (start of cycle again)4

References