How to Calculate the Day of the Week from Any Date
Here is a calendar calculation technique that I learned from a book called Mind Performance Hacks. It allows you to take a date, like 14 March 1879, and mentally calculate which day of the week it fell on.
First, we’ll show you how to do the technique from scratch, and then we’ll give you an interactive date calculator that you can use to check every step of the algorithm.
The Formula
The formula is:
(Year Code + Month Code + Century Code + Date Number - Leap Year Code) mod 7
Here’s How it Works
I’ll run through an example with the date, 14 March 1879 — Einstein’s birthday.
The Year Code
To calculate the Year Code, use this formula:
(YY + (YY div 4)) mod 7
YY is the last two digits of the year. For the year 1879, it’s 79.
First, divide YY by 4 and discard the remainder: 79 div 4 = 19.
Then add 19 back into the YY number, which is 79 in this case, resulting in 98.
The next step is: 98 mod 7.
“Mod” means divide the number and keep only the remainder. 98 / 7 = 14, and the remainder is 0, so 0 is our Year Code for 1879.
You could use a number shape image like a ball or egg to hold that in memory while you calculate the items below (because 0 looks like a ball or an egg, making it easy to remember that digit).
The Month Code
If you know how to memorize numbers you can quickly memorize the number 033614625035:
- January = 0
- February = 3
- March = 3
- April = 6
- May = 1
- June = 4
- July = 6
- August = 2
- September = 5
- October = 0
- November = 3
- December = 5
Now you have the Month Code. For Einsteins birthday in March, it is 3.
A Quick Note on Memorizing Numbers
If you don’t know how to memorize a number like 033614625035, you could either use repetition or learn a mnemonic system like the Major System or Dominic System. I use my Ben System images: Samwise (033) throws a glass of beer (614) on George Boole (625) who falls backwards on Sally (035).
A way to quickly memorize 033614625035 without a complex mnemonic system would be to use a number shape system to associate images with each month. For example, you could picture a game of soccer (football) in January, with ball being a mnemonic image for zero. You could picture a butterfly in February and March, if you use a butterfly image for the number three. If the number six is represented by the image of an elephant, picture an elephant in April and July, and so on. If you are having trouble associating the images with the months, pick an aspect of each month to associate the image with. For example, Halloween is in October, so to remember that October has a Month Code of zero (represented by an image of a ball), you could picture a group of people in Halloween costumes doing something with a ball. That would link the month of October with the number zero.
The Century Code
You then need to apply an adjustment based on the century. In Great Britain, and what was to become the USA, the calendar system changed from the Julian Calendar to the Gregorian Calendar on 2 September 1752. The Gregorian Calendar began on 14 September 1752, skipping 11 days.
Gregorian Dates
For the Gregorian Calendar, remember the number 4206420:
- 1700s = 4
- 1800s = 2
- 1900s = 0
- 2000s = 6
- 2100s = 4
- 2200s = 2
- 2300s = 0
If you are only doing this calendar trick with friends’ birthdays, you could probably leave this step out, because dates that fall in the 1900s get a Century Code of zero and don’t affect the outcome of the calculation.
Julian Dates
If you are looking at a Julian date, the formula is to divide the full year by 100 and round down. Subtract that number from 18. Then mod 7.
(18 - (YYYY div 100)) mod 7
or if you do any programming:
# python3
(18 - (YYYY // 100)) % 7
// JavaScript
(18 - Math.floor(YYYY / 100)) % 7;
Example 1: if the year is 825 CE, calculate 825 divided by 100, which gives you 8.25. Discard the remainder giving you 8. 18 minus 8 is 10. 10 mod 7 is 3. The Century Code is 3.
Example 2: if the year is 1625 CE, calculate 1625 divided by 100, which gives you 16.25. Discard the remainder, giving you 16. 18 minus 16 is 2. 2 mod 7 is 2. The Century Code is 2.
For Einsteins birthday in 1879, the Century Code is 2, because it’s a Gregorian date, and the chart above shows that dates in the 1800s get an adjustment of 2.
Leap Year Code
The other thing to take into account is whether you are dealing with a leap year. EDIT: If the date is in a January or February of a leap year, you have to subtract one from your total before the final step.
Gregorian Calendar
If you can divide a Gregorian year by 4, it’s a leap year, unless it’s divisible by 100. But it is a leap year if it’s divisible by 400.
- 1992 is a leap year because you can divide it by four.
- 1900 is not a leap year because you can divide it by 100.
- 2000 is a leap year because you can divide it by 400.
Julian Calendar
If you can divide a Julian year by 4, it’s a leap year.
Einstein’s birthday was in 1879 which was not a leap year (0), so it doesn’t affect the outcome.
Mental Calculation and Mathematics Guide
Learn more about mental calculation and mathematics.
Calculating the Day
Back to the original formula:
(Year Code + Month Code + Century Code + Date Number - Leap Year Code) mod 7
For 14 March 1879, here are the results:
- Year Code: 0
- Month Code: 3
- Century Code: 2
- Date Number: 14 (the 14th of the month)
- Leap Year Code: 0
So:
(0 + 3 + 2 + 14) mod 7 = 5
Match the resulting number in the list below, and you’ll have the day of the week:
- 0 = Sunday
- 1 = Monday
- 2 = Tuesday
- 3 = Wednesday
- 4 = Thursday
- 5 = Friday
- 6 = Saturday
Our result was 5, so Einstein was born on a Friday.
Date Calculator Tool (Beta)
Here’s an interactive tool that you can use to see how the algorithm works and check your answers. For best results, you should practice without the tool and then use the tool to check your answers.
This tool is new. If you notice any errors, please email [email protected] so we can fix them.
Use the following form to enter your date. The tool only calculates years from 1700 to 2399, but that should provide enough examples to teach you the algorithm. When the calendar switched from Julian to Gregorian, 11 days disappeared, so there are no dates between September 3, 1752 and September 13, 1752.
Results:
| Calendar | Gregorian |
| Year Code | (79 + (79 div 4 )) mod 7 = 0 |
| Month Code | 3 |
| Century Code | 2 |
| Day | 14 |
| Leap Year Modifier | 0 |
| Weekday | 5 (Friday) |
Calculation: (0 + 3 + 2 + 14 - 0) mod 7 = 5
- Sunday
- Monday
- Tuesday
- Wednesday
- Thursday
- Friday
- Saturday
More Examples
Here are three more examples from different centuries:
The Moon Landing
Humans set foot on the moon: 20 July 1969:
- Take ‘69 and divide by 4, discarding the remainder. That leaves 17. Add 69 to 17 to get 86. Then, 86 mod 7 = 2. The Year Code is 2.
- The Month Code for July is 6.
- The Century Code for the 1900s is zero.
- The Date Number is 20, because it’s the 20th of July.
- 1969 wasn’t a leap year since it can’t be divided by 4.
- 2 + 6 + 0 + 20 = 28
- 28 mod 7 = 0
20 July 1969 was a Sunday.
The Battle of Hastings
The Battle of Hastings took place on 14 October 1066.
- Take ‘66 and divide by 4, ignoring the remainder: 16. Add 66 to 16 to make 82. 82 mod 7 makes a Year Code of 5.
- October has a Month Code of zero.
- The Day Number is 14.
- The Century Code for this Julian date is 18 - 10 = 8. 8 mod 7 = 1.
- 1066 was not a leap year.
- Answer: 5 + 0 + 14 + 1 = 20. 20 mod 7 = 6
14 October 1066 was a Saturday.
Y2K
1 January 2000:
- Start with ‘00, leaving a Year Code of zero.
- January has a Month Code of zero.
- The Day Number is 1.
- The Century Code for dates in the 2000s is 6.
- 2000 is a leap year, since it can be divided by 400, and the date is in a January or February, so subtract 1 from the total in the final step.
- Answer: 0 + 0 + 1 + 6 - 1 = 6.
1 January 2000 was a Saturday.
If you have any questions, leave a comment in the forum. Learn more on our mental math and calculation page. There are also some shortcuts and tips in the Mentat Wiki — scroll down to the section titled, “The Classic Formula”.
