Header image
#0140
Day of the week

TitleAttribute

The following is a simple system for calculating the Day of the Week (e.g."Monday"), given a Month, Date, and Year. It's designed to be simple enough to allow you to do the math in your head.

Here's how it works:

First, you need to memorize a Month Code for each month. The Month Codes never change. (Good mnemonics for months of July and August would be welcome.)

Month
Code
Possible mnemonic
January
4
French janvier, German vier = 4
February
0
Feb-NO-ary
March
0
March-o is Macho
April
3
TRE-pril
May
5
Cinco de mayo
June
1
June-o is UNO
July
3
 
August
6
 
September
2
Sep-TWO-mber
October
4
Oct over 2
November
0
NO-vember
December
2
DEUX-cember

Then, you need to learn a Year Code for nearby years. The year code varies by year. Here are enough years to last me the rest of my life, with leap years in bold:

Year
Code
Year
Code
2000
2
2020
6
2001
3
2021
0
2002
4
2022
1
2003
5
2023
2
2004
0
2024
4
2005
1
2025
5
2006
2
2026
6
2007
3
2027
0
2008
5
2028
2
2009
6
2029
3
2010
0
2030
4
2011
1
2031
5
2012
3
2032
0
2013
4
2033
1
2014
5
2034
2
2015
6
2035
3
2016
1
2036
5
2017
2
2037
6
2018
3
2038
0
2019
4
2039
1

Note that the year code goes up by one each common year, and up by two each leap year, except zero follows six.

Now: to calculate the day of the week: just add the Month code and the Year Code to the date. Special case: in January or February of a leap year, subtract one.

Then subtract out the largest possible multiple of 7. You will be left with a number from zero through six, which gives the day of the week as follows:

0
Sunday
1 through 5
Monday through Friday, respectively
6
Saturday

That’s all there is to it.

Here's an example: January 18, 2000:

 
Month
Day
Year
Sum
 
January
18
2000
 
Month code, date, and year code:
4
18
2
24
Special case: Jan/Feb of leap year:
   
-1
23
Subtract largest possible multiple of 7:
   
-21
2
Corresponding day:
     
Tuesday

You can actually subtract out multiples of 7 at any point in the calculation. For instance, in the example, the date "18" can be taken as equivalent to 4 (that is, 18 - 14). Sometimes it’s easier to do the math in your head if you subtract the largest possible multiple of seven whenever possible, because you then are working with smaller numbers.

You can easily find the year codes for nearby years by remembering that the year code goes up by one each common year, and by 2 each leap year, except that 0 follows 6. During leap years, remember to subtract one from the total in January and February.

How do you identify a leap year? Within each century, four-digit years evenly divisible by 4 are leap years. That simple rule will work through 2099.

The more general rule: four-digit years evenly divisible by 4 are leap years, except that if they are evenly divisible by 100, they are not leap years unless they are also evenly divisible by 400. Thus the year 2000 was a leap year, but 2100 will not be. For year codes over a wider range than given in the table above, see the tables below.

For the mathematically inclined: we are simply adding appropriate offsets for the month and the year to the date, and taking the result "modulo 7", since there are seven days in a week.

I find that when I do the above calculation in my head, as simple as it is, I do still make errors, generally simple errors of arithmetic in one of the very few required steps.

The alert reader of my blog might recall that I previously discussed a very simple computer program to compute the day of the week, in my entry called Time. Specifically, the program was shown and explained in that entry in Note 4, and it uses some tricks of integer arithmetic. However, that method, while compact and simple for a computer, is not suitable for a person to do mentally. It involves steps such as multiplication by numbers like 153 and 1461, sums of large integers, and finally division by seven.

After developing the above day-of-the-week algorithm myself, I discovered that many other people have tried to find simple ways of doing this. Among the more notable of these was the author of Alice in Wonderland, Lewis Carroll. Many years later, John Horton Conway simplified Carroll's algorithm to make it even easier to remember. You can read about this in a 2011 Scientific American article called What Day Is Doomsday?.

Year Codes from 1600 through 3999

Getting back to my method, here's a more complete table of year codes. Given a four-digit year "xxxx", add the numbers obtained from the following two tables, subtracting seven whenever the sum is seven or higher. The first table is based on the first two digits of the year (the "century" portion), and the second table is based on the last two digits (the "2-digit" year):

Cent.
x0xx
x1xx
x2xx
x3xx
x4xx
x5xx
x6xx
x7xx
x8xx
x9xx
1xxx
2
0
5
3
2xxx
2
0
5
3
2
0
5
3
2
0
3xxx
5
3
2
0
5
3
2
0
5
3
 
2-digit
xxx0
xxx1
xxx2
xxx3
xxx4
xxx5
xxx6
xxx7
xxx8
xxx9
xx0x
0
1
2
3
5
6
0
1
3
4
xx1x
5
6
1
2
3
4
6
0
1
2
xx2x
4
5
6
0
2
3
4
5
0
1
xx3x
2
3
5
6
0
1
3
4
5
6
xx4x
1
2
3
4
6
0
1
2
4
5
xx5x
6
0
2
3
4
5
0
1
2
3
xx6x
5
6
0
1
3
4
5
6
1
2
xx7x
3
4
6
0
1
2
4
5
6
0
xx8x
2
3
4
5
0
1
2
3
5
6
xx9x
0
1
3
4
5
6
1
2
3
4

Example: 1995. Looking up "19xx" in the first table gives 3 (in bold red above), and looking up "xx95" in the second table gives 6 (also in bold red). 3 plus 6 is 9; since this is 7 or greater, subtract 7, giving 2. Thus, the year code for 1995 was 2.

Of course, at the end of any year, you don’t need to repeat the calculation to get the code for the following year. You can simply add one (in a common year) or two (in a leap year), and subtract seven from the result whenever possible (which means that 7 becomes 0, and 8 becomes 1).

Most interesting dates relative to our own lifetimes are in the 1900’s and 2000’s, so the most frequently needed values from the first table are 19xx (value 3) and 20xx (value 2).

Note that this method is not correct earlier than 1582, when the Gregorian calendar was first promulgated by Pope Gregory XIII. In fact, the Gregorian calendar was not adopted by Britain until 1752, in which year September 14 followed September 2 (most British subjects, such as George Washington, adjusted their birthdays to account for the missing 11 days). By the year 4000, the Gregorian calendar will be off by about a day, and some additional correction will probably be instituted, but just what this will be has not yet been agreed upon.

For the mathematically inclined, the first table contains (int(5.25C+2) mod 7), where C is the century portion of the year, "int(x)" is the largest integer in x, and (x mod 7) is x modulo 7. Note that these entries cycle through the values 2, 0, 5, and 3 every four centuries. Be sure to look up just the first two digits of the four-digit year; it is not corrected by one. That is, the "century portion" of the 1900’s is "19", even though the 1900’s are called "the twentieth century".

The second table contains (int(1.25T) mod 7), where T is the two-digit portion of the year.

Running out of time to write a blog entry this week, I shamelessly stole this one from the page Calculating the day of the week in your head on my "old" web pages (clicking that link will open it in a new window). I've been gradually moving some of the more interesting material from my old web pages into the blog.
 

Footer image
#0140   *MATHEMATICS

Next in blog     Blog home     Help     Next in memoirs
Blog index     Numeric index     Memoirs index     Alphabetic index
© 2012 Lawrence J. Krakauer   Click here to send me e-mail.
Originally posted July 19, 2012, and slightly modified July 20, 2012

Bottom image