Doomsday rule


The Doomsday rule is an algorithm of determination of the day of the week for a given date. It provides a perpetual calendar because the Gregorian calendar moves in cycles of 400 years. The algorithm for mental calculation was devised by John Conway in 1973, drawing inspiration from Lewis Carroll's perpetual calendar algorithm. It takes advantage of each year having a certain day of the week upon which certain easy-to-remember dates, called the doomsdays, fall; for example, the last day of February, 4/4, 6/6, 8/8, 10/10, and 12/12 all occur on the same day of the week in any year. Applying the Doomsday algorithm involves three steps: Determination of the anchor day for the century, calculation of the anchor day for the year from the one for the century, and selection of the closest date out of those that always fall on the doomsday, e.g., 4/4 and 6/6, and count of the number of days between that date and the date in question to arrive at the day of the week. The technique applies to both the Gregorian calendar and the Julian calendar, although their doomsdays are usually different days of the week.
The algorithm is simple enough that it can be computed mentally. Conway could usually give the correct answer in under two seconds. To improve his speed, he practiced his calendrical calculations on his computer, which was programmed to quiz him with random dates every time he logged on.

Anchor days for some contemporary years

Doomsday's anchor day for the current year in the Gregorian calendar is. For some other contemporary years:
Mon.Tue.Wed.Thu.Fri.Sat.Sun.
189818991900190119021903
190419051906190719081909
191019111912191319141915
19161917191819191920
192119221923192419251926
19271928192919301931
193219331934193519361937
193819391940194119421943
19441945194619471948
194919501951195219531954
19551956195719581959
196019611962196319641965
196619671968196919701971
19721973197419751976
197719781979198019811982
19831984198519861987
198819891990199119921993
199419951996199719981999
20002001200220032004
200520062007200820092010
20112012201320142015
201620172018201920202021
202220232024202520262027
20282029203020312032
203320342035203620372038
20392040204120422043
204420452046204720482049
205020512052205320542055
20562057205820592060
206120622063206420652066
20672068206920702071
207220732074207520762077
207820792080208120822083
20842085208620872088
208920902091209220932094
209520962097209820992100

The table is filled in horizontally, skipping one column for each leap year. This table cycles every 28 years, except in the Gregorian calendar on years that are a multiple of 100 that are not also a multiple of 400. The full cycle is 28 years in the Julian calendar, 400 years in the Gregorian calendar.

Memorable dates that always land on Doomsday

One can find the day of the week of a given calendar date by using a nearby doomsday as a reference point. To help with this, the following is a list of easy-to-remember dates for each month that always land on the doomsday.
As mentioned above, the last day of February defines the doomsday. For January, January 3 is a doomsday during common years and January 4 a doomsday during leap years, which can be remembered as "the 3rd during 3 years in 4, and the 4th in the 4th year". For March, one can remember the pseudo-date "March 0", which refers to the day before March 1, i.e. the last day of February.
For the months April through December, the even numbered months are covered by the double dates 4/4, 6/6, 8/8, 10/10, and 12/12, all of which fall on the doomsday. The odd numbered months can be remembered with the mnemonic "I work from 9 to 5 at the 7-11", i.e., 9/5, 7/11, and also 5/9 and 11/7, are all doomsdays.
Several common holidays are also on doomsday. The chart below includes only dates covered by the mnemonics in the sources listed.
MonthMemorable dateMonth/DayMnemonicComplete list of days
JanuaryJanuary 3,
January 4
1/3 OR 1/4the 3rd 3 years in 4 and the 4th in the 4th3, 10, 17, 24, 31 OR
FebruaryFebruary 28, February 29 2/28 OR 2/29last day of February0, 7, 14, 21, 28 OR
March"March 0"3/0last day of February0, 7, 14, 21, 28
AprilApril 44/44/4, 6/6, 8/8, 10/10, 12/124, 11, 18, 25
MayMay 95/99-to-5 at 7-112, 9, 16, 23, 30
JuneJune 66/64/4, 6/6, 8/8, 10/10, 12/126, 13, 20, 27
JulyJuly 117/119-to-5 at 7-114, 11, 18, 25
AugustAugust 88/84/4, 6/6, 8/8, 10/10, 12/121, 8, 15, 22, 29
SeptemberSeptember 59/59-to-5 at 7-115, 12, 19, 26
OctoberOctober 1010/104/4, 6/6, 8/8, 10/10, 12/123, 10, 17, 24, 31
NovemberNovember 711/79-to-5 at 7-110, 7, 14, 21, 28
DecemberDecember 1212/124/4, 6/6, 8/8, 10/10, 12/125, 12, 19, 26

Since the doomsday for a particular year is directly related to weekdays of dates in the period from March through February of the next year, common years and leap years have to be distinguished for January and February of the same year.
January and February can be treated as the last two months of the previous year.

Example

To find which day of the week Christmas Day of 2018 was, proceed as follows: in the year 2018, doomsday was Wednesday. Since December 12 is a doomsday, December 25, being thirteen days afterwards, fell on a Tuesday. Christmas Day is always the day before doomsday. In addition, July 4 is always on a doomsday, as are Halloween, Pi Day, and Boxing Day.

Mnemonic weekday names

Since this algorithm involves treating days of the week like numbers modulo 7, John Conway suggests thinking of the days of the week as "Noneday"; or as "Sansday", "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day" in order to recall the number-weekday relation without needing to count them out in one's head.
day of weekIndex
number
Mnemonic
Sunday0Noneday or
Sansday
Monday1Oneday
Tuesday2Twosday
Wednesday3Treblesday
Thursday4Foursday
Friday5Fiveday
Saturday6Six-a-day

There are some languages, such as Slavic languages, Greek, Portuguese, Galician, Hebrew and Chinese, that base some of the names of the week days in their positional order.

Finding a year's anchor day

First take the anchor day for the century. For the purposes of the doomsday rule, a century starts with '00 and ends with '99. The following table shows the anchor day of centuries 1800–1899, 1900–1999, 2000–2099 and 2100–2199.
CenturyAnchor dayMnemonicIndex
1800–1899Friday5
1900–1999WednesdayWe-in-dis-day
3
2000–2099TuesdayY-Tue-K or Twos-day
2
2100–2199SundayTwenty-one-day is Sunday
0

For the Gregorian calendar:
For the Julian calendar:
Note:.
Next, find the year's anchor day. To accomplish that according to Conway:
  1. Divide the year's last two digits by 12 and let be the floor of the quotient.
  2. Let be the remainder of the same quotient.
  3. Divide that remainder by 4 and let be the floor of the quotient.
  4. Let be the sum of the three numbers.
  5. Count forward the specified number of days from the anchor day to get the year's one.
For the twentieth-century year 1966, for example:
As described in bullet 4, above, this is equivalent to:
So doomsday in 1966 fell on Monday.
Similarly, doomsday in 2005 is on a Monday:

Why it works

The doomsday's anchor day calculation is effectively calculating the number of days between any given date in the base year and the same date in the current year, then taking the remainder modulo 7. When both dates come after the leap day, the difference is just . But 365 equals 52 × 7 + 1, so after taking the remainder we get just
This gives a simpler formula if one is comfortable dividing large values of by both 4 and 7. For example, we can compute
which gives the same answer as in the example above.
Where 12 comes in is that the pattern of almost repeats every 12 years. After 12 years, we get. If we replace by, we are throwing this extra day away; but adding back in compensates for this error, giving the final formula.

The "odd + 11" method

A simpler method for finding the year's anchor day was discovered in 2010 by Chamberlain Fong and Michael K. Walters, and described in their paper submitted to the 7th International Congress on Industrial and Applied Mathematics. Called the "odd + 11" method, it is equivalent to computing
It is well suited to mental calculation, because it requires no division by 4, and the procedure is easy to remember because of its repeated use of the "odd + 11" rule.
Extending this to get the anchor day, the procedure is often described as accumulating a running total in six steps, as follows:
  1. Let be the year's last two digits.
  2. If is odd, add 11.
  3. Now let.
  4. If is odd, add 11.
  5. Now let.
  6. Count forward days from the century's anchor day to get the year's anchor day.
Applying this method to the year 2005, for example, the steps as outlined would be:
  1. Doomsday for 2005 = 6 + Tuesday = Monday
The explicit formula for the odd+11 method is:
Although this expression looks daunting and complicated, it is actually simple because of a common subexpression that only needs to be calculated once.

Correspondence with dominical letter

Doomsday is related to the dominical letter of the year as follows.
Look up the table below for the dominical letter.
For the year 2017, the dominical letter is A - 0 = A.

Overview of all Doomsdays

MonthDatesWeek numbers *
January 3, 10, 17, 24, 311–5
January 4, 11, 18, 251–4
February 7, 14, 21, 286–9
February 1, 8, 15, 22, 295–9
March7, 14, 21, 2810–13
April4, 11, 18, 2514–17
May2, 9, 16, 23, 3018–22
June6, 13, 20, 2723–26
July4, 11, 18, 2527–30
August1, 8, 15, 22, 2931–35
September5, 12, 19, 2636–39
October3, 10, 17, 24, 3140–44
November7, 14, 21, 2845–48
December5, 12, 19, 2649–52

* In leap years the th doomsday is in ISO week. In common years the day after the th doomsday is in week. Thus in a common year the week number on the doomsday itself is one less if it is a Sunday, i.e. in a common year starting on Friday.

Computer formula for the anchor day of a year

For computer use, the following formulas for the anchor day of a year are convenient.
For the Gregorian calendar:
For example, the doomsday 2009 is Saturday under the Gregorian calendar, since
As another example, the doomsday 1946 is Thursday, since
For the Julian calendar:
The formulas apply also for the proleptic Gregorian calendar and the proleptic Julian calendar. They use the floor function and astronomical year numbering for years BC.
For comparison, see the calculation of a Julian day number.

400-year cycle of anchor days

Since in the Gregorian calendar there are 146097 days, or exactly 20871 seven-day weeks, in 400 years, the anchor day repeats every four centuries. For example, the anchor day of 1700–1799 is the same as the anchor day of 2100–2199, i.e. Sunday.
The full 400-year cycle of doomsdays is given in the adjacent table. The centuries are for the Gregorian and proleptic Gregorian calendar, unless marked with a J for Julian. The Gregorian leap years are highlighted.
Negative years use astronomical year numbering. Year 25BC is −24, shown in the column of −100J or −100, at the row 76.
SundayMondayTuesdayWednesdayThursdayFridaySaturdayTotal
Non-leap years43434343444344303
Leap years1315131513141497
Total56585658575758400

A leap year with Monday as doomsday means that Sunday is one of 97 days skipped in the 400-year sequence. Thus the total number of years with Sunday as doomsday is 71 minus the number of leap years with Monday as doomsday, etc. Since Monday as doomsday is skipped across 29 February 2000 and the pattern of leap days is symmetric about that leap day, the frequencies of doomsdays per weekday are symmetric about Monday. The frequencies of doomsdays of leap years per weekday are symmetric about the doomsday of 2000, Tuesday.
The frequency of a particular date being on a particular weekday can easily be derived from the above.
For example, 28 February is one day after doomsday of the previous year, so it is 58 times each on Tuesday, Thursday and Sunday, etc. 29 February is doomsday of a leap year, so it is 15 times each on Monday and Wednesday, etc.

28-year cycle

Regarding the frequency of doomsdays in a Julian 28-year cycle, there are 1 leap year and 3 common years for every weekday, the latter 6, 17 and 23 years after the former. The same cycle applies for any given date from 1 March falling on a particular weekday.
For any given date up to 28 February falling on a particular weekday, the 3 common years are 5, 11, and 22 years after the leap year, so with intervals of 5, 6, 11, and 6 years. Thus the cycle is the same, but with the 5-year interval after instead of before the leap year.
Thus, for any date except 29 February, the intervals between common years falling on a particular weekday are 6, 11, 11. See e.g. at the bottom of the page Common year starting on Monday the years in the range 1906–2091.
For 29 February falling on a particular weekday, there is just one in every 28 years, and it is of course a leap year.

Julian calendar

The Gregorian calendar is currently accurately lining up with astronomical events such as solstices. In 1582 this modification of the Julian calendar was first instituted. In order to correct for calendar drift, 10 days were skipped, so doomsday moved back 10 days : Thursday 4 October was followed by Friday 15 October. The table includes Julian calendar years, but the algorithm is for the Gregorian and proleptic Gregorian calendar only.
Note that the Gregorian calendar was not adopted simultaneously in all countries, so for many centuries, different regions used different dates for the same day.

Full examples

Example 1 (1985)

Suppose you want to know the day of the week of September 18, 1985. You begin with the century's anchor day, Wednesday. To this, add,, and above:
This yields. Counting 8 days from Wednesday, we reach Thursday, which is the doomsday in 1985., and 3 + 1 = 4, doomsday in 1985 was Thursday We now compare September 18 to a nearby doomsday, September 5. We see that the 18th is 13 past a doomsday, i.e. one day less than two weeks. Hence, the 18th was a Wednesday.

Example 2 (other centuries)

Suppose that you want to find the day of week that the American Civil War broke out at Fort Sumter, which was April 12, 1861. The anchor day for the century was 99 days after Thursday, or, in other words, Friday. The digits 61 gave a displacement of six days so doomsday was Thursday. Therefore, April 4 was Thursday so April 12, eight days later, was a Friday.