How to Calculate the Day of the Week from a Date

One of my hobbies aside from cubing is calculating the day of the week from a date. This trick is called the “Human Calendar”, and is perhaps easier to do that it seems on first glance. Don’t be fooled though – getting fast takes a lot of practise!

This post will teach you how to do this cool trick!

Here’s a demonstration of me calculating 10 random dates between 1900 and 1999 and then 10 random dates between the years 1900 and 9999.

I will explain the method that I use and give some guidance for practising and getting faster.

Here’s an example date: 17/05/1963. This is of course written in dd/mm/yyyy format. There are 4 parts to the date:
a. Day = 17
b. Month = 5
c. Year = 63
d. Century = 19

A calculation must be done on each of these parts to give a DayValue, MonthValue, YearValue and CenturyValue and then combined to get the final result.

Day
Super easy. Just use the number as it is. DayValue = 17

Month
Learn these lookup codes
January = 0
February = 3
March = 3
April = 6
May = 1
June = 4
July = 6
August = 2
September = 5
October = 0
November = 3
December = 5
For the example above we are in May, which gives us a MonthValue of 1

Year
YearValue = Year + floor(Year/4)
In this example we get:
YearValue = 63 + floor(63/4) = 63 + 15 = 78

Century
Take the remainder when the century is divided by 4, then lookup from this list:
Remainder 0 -> 6
Remainder 1 -> 4
Remainder 2 -> 2
Remainder 3 -> 0
Our century is 19 which gives a remainder of 3 and CenturyValue = 0

End Game
Add the 4 values up and mod 7 the result
17 + 1 + 78 + 0 = 96
96 mod 7 = 5
The final result is 5
Monday is the first day of the week in my system, so 5 means Friday
17/05/1963 was a Friday.

Leap Years
They are the most annoying thing ever. One final thing to remember is that if the date is in January or February of a leap year, you should take off 1 during your final calculation.
Leap years are every 4 years, apart from on the first year of any century that does not divide by 4. So 1900 is not a leap year, but 2000 is.
Don’t worry if they trip you up to start with – they’re easy to miss.

 

Guidance for initial learning

1. Read through the method.
2. If you don’t think of Monday as the first day of the week (preference can differ from person-to-person and culture-to-culture), you should change the Month Codes. If you want Sunday to be 1 through to Saturday as 0/7 then add 1 to all the Month Codes above before learning them.
2. Learn the 12 Month codes really well so that you can easily recall the MonthValues.
3. Learn multiples of 7 up to 119 really well, so you don’t have trouble taking mod 7 of any number up to that.
4. Don’t worry about the Century part for now – to start with you should just practise dates in the 1900s which has a century code of 0.
5. Study your errors when you make them. If you can pinpoint which part you did wrong it will help you not to repeat the mistake.

Download the Excel program shown in the video: Date calculator v2_release

 

Guidance for further improvement

Once you have the basics down, you can do a number of things to advance.
1. Learn how to deal with different Centuries and start practising Hard mode on the Excel program.
2. Take mod 7 of any of the values as you go along. Rather than waiting until the end then doing mod 7, you can mod 7 at any point to keep the numbers smaller. E.g. as soon as you see the Day is 17, you can think “3” instead.
3. Learn all the YearValues. Rather than doing the calculation each time, I see the 2 digit number and immediately know the final YearValue between 0 and 6. I did this by making a full lookup table of the 100 cases and learning and drilling 10 of them at first, then adding 10 more etc until I knew all 100 cases really well.
4. Have a set order for calculation. I look at the Day and Month first, then add the YearValue and finally the CenturyValue.
5. Lookahead. I start looking and calculating the Day and Month Values for the next date while I finish off the CenturyValue part and my finger thinks about where the number for the previous date is on the numpad. That’s why my first date is always the slowest, and the rest I can look ahead for.
6. PRACTISE. Before I practised properly, I drilled all my knowledge a lot, practising all the year codes for a long time as recommended in tip 3. After that it took 1500 dates or so to get to sub-30 on Hard mode, 13,000 to sub-20 and finally after 117,000 I got a sub-10 second average. After 171,000 dates I now have a sub-9 average (0.9 secs per date).