How To Calculate Day Of The Week For Any Date? - An image asking the question: On which day of the week does the following date fall? - 24/10/2022

How would it be if you were able to calculate day of the week for any date? With a little bit of math and logic, anything is possible!

Before you start celebrating, be warned that this technique requires a little bit of effort and practice upfront. But once you understand it and have enough practice, you’ll be pulling off magic-trick-like performances in front of your friends at parties.

The algorithm that I will be demonstrating in this essay is called the Doomsday algorithm and was originally proposed by John Conway in 1973 (link in the references section at the end of the essay). Conway, in turn, had simplified a rule proposed by Lewis Carrol in 1872 to arrive at this algorithm.

The Doomsday algorithm is split into three significant steps:

1. Computing the Doomsday for a given date’s century year.

2. Computing the Doomsday for the specific year of the given date.

3. Computing the precise day of the week for the given date.

Let us begin by defining what a ‘Doomsday’ is.


Defining Doomsdays

To keep things clean and defined upfront, I will be using the following date format throughout this essay: DD/MM/YYYY (Day/Month/Year). Furthermore, I will be demonstrating the Doomsday algorithm for the Gregorian calendar only (used post-September 1752).

From this definition, it becomes clear that the date is comprised of three elements: the day, the month, and the year.

Conway defines a Doomsday for any given year as the day of the week on which the last day of February falls. The Doomsday algorithm then goes on to take advantage of the fact that there are several significant dates in each month of each year that fall on the same day.

In short, if we know on which weekday the last day of February (of a particular year) falls, we know a whole bunch of (more or less) equally spaced dates throughout the year that fall on the same day. Based on this, we could compute the day of the week for any date on that year using simple addition and/or subtraction.

But how do we know on which day of the week the last date of February falls? Well, before we answer that question, let us establish the relationships between the various Doomsdays distributed throughout the year.

This essay is supported by Generatebg

A product with a beautiful background featuring the sponsor: Generatebg - a service that generates high-resolution backgrounds in just one click. The description says "No more costly photographers" and displays a "Get Started" button beneath the description.

List of Doomsdays Throughout Any Given Year

Let us start with the low hanging fruits first: January and February:

How To Calculate Day Of The Week For Any Date? — January 31st and February 28th for normal years and January 32nd and February 29th for leap years respectively.
Image created by the author

January 32nd does not exist in reality (it’s February 1st), but Conway recommends this style of thinking as he feels that it is easier for us to remember the logic.

Next up, we have the even months of the year. These are pretty easy, as given by the list below:

How To Calculate Day Of The Week For Any Date? — 04/04; 06/06; 08/08; 10/10; 12/12
Image created by the author

The odd months of the year are a little trickier but follow a simple logic nonetheless. For any odd month numbered ’n’, the Doomsday is given by n +/- 4. For odd months that are long (31 days), the Doomsday is given by n + 4. For odd months that are short (30 days — September and November only), the Doomsday is given by n-4.

To sum up, the comprehensive Doomsday list one needs to remember looks as follows:

How To Calculate Day Of The Week For Any Date? — Jan 31/32*, Feb 28/29*, Mar 3+4 = 7, Apr 4, May 5 + 4 = 9, June 6, July 7 + 4 = 11, Aug 8, Sep 9–4 = 5, Oct 10, Nov 11–4 = 7, Dec 12 (* leap year)
Image created by the author

Once you have this list, you could always add or subtract multiples of 7 to arrive at other doomsdays for the respective year.

Example Calculation

Let us say that we are interested in calculating the day of the week for the date: 30/10/2022

Assume that someone tells us that Doomsdays for the year 2022 occur on Mondays. Based on this information, we could say that the date 10/10/2022 occurs on a Monday. This is because we know that 10/10/2022 is a Doomsday as well. By adding 14, we arrive at the next Doomsday as 24/10/2022. By adding 6 to this date, we arrive at Sunday (Monday + 6) as the answer for 30/10/2022.

But hang on a minute! I was able to do that only because I knew the Doomsday for 2022 (Monday). How do we figure that part out? Right, onward to that question we march.


Computing Doomsday for Any Given Century

Tostart, one needs to just remember that the years 0, 400, 800, 1200, 1600, … are all Tuesdays. Basically, the Doomsdays for all years that are multiples of 400 occur on Tuesdays. For every century after a multiple of 400, Doomsday is retarded by 2 days.

For instance, 2000 is a multiple of 400. So, we could directly say that the Doomsday for this century occurs on a Tuesday as well. On the other hand, 1900 is 300 years (3 centuries) after 1600 (the previous multiple of 400). So, we subtract 6 from Tuesday (2*3) to arrive at Wednesday as the answer.

So far, we have means of computing the Doomsday for any given century year. But what about the years in between two centuries? That is pretty much the final piece of the puzzle we need to solve.

Computing Doomsday for Any Year Within the Century

Let us say that we have already computed the Doomsday for a given century. Each ordinary year has its Doomsday 1 day later than the previous year, and each leap year 2 days later. We could use this to our advantage by splitting each century into multiples of 12.

Such a division would lead to 12, 24, 36, 48, 60, 72, 84, and 96. Say that we are interested in Doomsday for 2012. We know that the Doomsday for 2000 occurs on a Tuesday (based on our ‘Doomsday for any century’ logic).

For any given 12 years (a dozen years), there are a total of 12/4 = 3 leap years. So, for each dozen years, the Doomsday is shifted by (12+3) = 14 + 1 = 1 day. consequently, we add 1 day to Tuesday to arrive at Wednesday as the Doomsday for 2012.


How To Calculate Day of the Week for Any Date

We have finally arrived at the point where we are ready to calculate the day of the week for any date. To show off, let us consider the following date: 20/06/3075. That’s right! This algorithm can be used to calculate the day of the week for future dates as well!

Firstly, let us compute the Doomsday for the century. 3000 occurs 2 centuries after 2800, which is the previous closest multiple of 400. So, for 2800, the Doomsday is Tuesday. For each century after that, we retard Tuesday by 2. Therefore, we subtract 4 from Tuesday to arrive at Friday as the Doomsday for 3000.

Next, we need to calculate the Doomsday for 3075. We know that 12*6 = 72 and 75 = (12*6) + 3. So, we need to add (6+3) days to Friday (the Doomsday for 3000). Furthermore, the number of 4s in 3(75–72 = 3) is zero. This means that there will be 0 leap years from 3072 to 3075. Consequently, we could calculate the Doomsday for 3075 as follows:

Doomsday for 3075 = Friday + (6+3) + 0

= Friday + 9

= Friday + 7 + 2

= Friday + 2

Sunday!

Now, we know that 06/06/3075 occurs on a Sunday (a Doomsday!). We also know that 14 + 6 = 20. So, 20/06/3075 is also a Doomsday. Therefore, 20/06/3075 occurs on a Sunday as well!

There you have it; that’s pretty much it!

Summary

Tosum up, here is a ten-step process to execute the Doomsday algorithm to your pleasure at any party:

1. Gather an entertaining crowd.

2. Ask a random person to come up with a random date.

3. Compute the Doomsday for the century year in your head.

4. Add the number of dozens of years after the century year, the remainder, and the number of fours in the remainder (again, in your head). This will give you the Doomsday of that particular year.

5. Finally, use the comprehensive Doomsday list from your memory to compute the day of the week for the particular date.

6. Ask a random person to check if you are correct.

7. Enjoy the awesome reaction from the crowd.

8. Wearing a smug face and dare someone else in the crowed to challenge you with a new random date.

9. Repeat the entire process.

10. For extra crowd-reputation, nudge the crowd to choose a date in the distant future!!


Credit and reference: J.H. Conway (recreational science article — page 28).

I hope you found this article interesting and useful. If you’d like to get notified when interesting content gets published here, consider subscribing.

Further reading that might interest you: How To Mentally Square Any Number Ending in 5? and What Is So Special About 69! ?

Street Science

Explore humanity's most curious questions!

Sign up to receive more of our awesome content in your inbox!

Select your update frequency:

We don’t spam! Read our privacy policy for more info.