The Doomsday Algorithm
Calculating the day of the week given the date
- How many times does 12 fit into the last two digits of the year number?
- What’s the remainder from calculation one?
- How many times does 4 fit into the result of calculation two?
- What is this century’s anchor day?
- Add up all these four results
- 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/Day | Mneumonic |
---|---|
1/3 (common years), 1/4 (leap ye It’s the 3rd three out of four years, and the 4th otherwise e e e e | |
2/28 (common years), 2/29 (leap years) | Last day |
3/14 | |
4/4 | |
5/9 | |
6/6 | |
11/7 | |
8/8 | |
9/5 | |
10/10 | |
11/7 | |
Day numbers
How to assign numbers to each day.
Day name | Number |
---|---|
Monday | 0 |
Tuesday | 1 |
Wednesday | 2 |
Thursday | 3 |
Friday | 4 |
Saturday | 5 |
Sunday | 6 |
Anchor days
Used in the calculation.
Century | Day name | Number |
---|---|---|
1700-1799 | …Sunday (end of cycle) | 6 |
1800-1899 | Friday (start of cycle) | 4 |
1900-1999 | Wednesday | 2 |
2000-2099 | Tuesday | 1 |
2100-2199 | Sunday (end of cycle) | 6 |
2200-2299 | …Friday (start of cycle again) | 4 |