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.)
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:
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:
Thatís all there is to it.
Here's an example: January 18, 2000:
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?.
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):
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.