The Doomsday rule, Doomsday algorithm or Doomsday method 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, April 4 (4/4), June 6 (6/6), August 8 (8/8), October 10 (10/10), and December 12 (12/12) all occur on the same day of the week in the 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 (modulo 7) 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.
Doomsdays for contemporary years Doomsday for the current year in the Gregorian calendar (2026) is Saturday. Simple methods for finding the doomsday of a year exist.
Finding the day of the week from a year's 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. The last day of February is always a 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 either Pi Day or "March 0", the latter referring 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 (this is true for both the day/month and month/day conventions). John Conway wrote that: "Summary: 'Last' in Jan and Feb, otherwise nth in even months, (n ± 4) in odd ones". He clarified that: "The sign is + for long odd months (31 days), and − for short ones (30 days)". Several well-known dates, such as Independence Day in United States, Boxing Day, Halloween and Valentine's Day in common years, also fall on doomsdays every year.
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.
Example To find which day of the week Christmas Day of 2027 is, proceed as follows: in the year 2027, doomsday is on Sunday. Since December 12 is a doomsday, December 25, being thirteen days afterwards (two weeks less a day), will fall on a Saturday. Christmas Day is always the day of the week before doomsday. In addition, July 4 (U.S. Independence Day) is always on the same day of the week as a doomsday, as are Halloween (October 31), Pi Day (March 14), and December 26 (Boxing Day).
Mnemonic weekday names Since this algorithm involves treating days of the week like numbers modulo 7, John Conway suggested thinking of the days of the week as "Noneday" or "Sansday" (for Sunday), "Oneday", "Twosday", "Treblesday", "Foursday", "Fiveday", and "Six-a-day" to recall the number-weekday relation without needing to count them out in one's head.
There are some languages, such as Slavic languages, Chinese, Estonian, Greek, Portuguese and Hebrew, that base some of the names of the week days in their positional order. The Slavic, Chinese, and Estonian agree with the table above; the other languages mentioned count from Sunday as day one.
Finding a year's doomsday 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 1600–1699, 1700–1799, 1800–1899, 1900–1999, 2000–2099, 2100–2199 and 2200–2299.
For the Gregorian calendar:
Mathematical formula 5 × (c mod 4) mod 7 + Tuesday = anchor. Algorithmic Let r = c mod 4 if r = 0 then anchor = Tuesday if r = 1 then anchor = Sunday if r = 2 then anchor = Friday if r = 3 then anchor = Wednesday. For the Julian calendar:
6c mod 7 + Sunday = anchor. Note: c=⌊year100⌋. Next, find the year's anchor day. To accomplish that according to Conway:
Divide the year's last two digits (call this y) by 12 and let a be the floor of the quotient. Let b be the remainder of the same quotient. Divide that remainder by 4 and let c be the floor of the quotient. Let d be the sum of the three numbers (d = a + b + c). (It is again possible here to divide by seven and take the remainder. This number is equivalent, as it must be, to y plus the floor of y divided by four.) Count forward the specified number of days (d or the remainder of d/7) from the anchor day to get the year's one. (⌊y12⌋+ymod12+⌊ymod124⌋)mod7+anchor=Doomsday For the twentieth-century year 1966, for example:
(⌊6612⌋+66mod12+⌊66mod124⌋)mod7+Wednesday=(5+6+1)mod7+Wednesday =Monday As described in bullet 4, above, this is equivalent to:
(66+⌊664⌋)mod7+Wednesday=(66+16)mod7+Wednesday =Monday So doomsday in 1966 fell on Monday. Similarly, doomsday in 2005 is on a Monday:
(⌊512⌋+5mod12+⌊5mod124⌋)mod7+Tuesday=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 (if any), the difference is just 365y + y/4 (rounded down). But 365 equals 52 × 7 + 1, so after taking the remainder we get just
… excerpt ends here. Continue reading the full article.



