The
Doomsday rule or
Doomsday algorithm is a way of
calculating the day of the week of a given date. It provides a
perpetual calendar since the
Gregorian calendar moves in cycles of 400
years.
[citation needed]The algorithm for mental calculation was invented by John Conway[1]. takes advantage of the fact that within any calendar year, the days of 4/4, 6/6, 8/8, 10/10, 12/12, and the last day of February always occur on the same day of week - the so-called "doomsday" (and furthermore that other months have "doomsday" on the pairs 5/9 and 9/5 as well as 7/11 and 11/7, which can be remembered using a simple mnemonic). This applies to both the Gregorian calendar A.D. and the Julian calendar, but note that for the Julian calendar the Doomsday of a year is a weekday that is usually different from that for the Gregorian calendar.
The algorithm has three steps namely, finding the anchor day for the century, finding a year's Doomsday, and finding the day of week of the day in question.
We first take the anchor day for the century. For the purposes of the Doomsday rule, a century starts with a 00 year and ends with a 99 year. The following table shows the anchor day of centuries 1800-1899, 1900-1999, 2000-2099 and 2100-2199.