![]() |
Be Your Own Perpetual Calendar |
Calculate the Day of the Week for any Date
It's easier than you might think. A short string of digits and a short formula are all that are required for an all-encompassing calendar. In fact, anyone reasonably proficient with numbers can perform this calculation in his/her head! While your companions are fumbling for a notebook or reaching for a PDA, you could already have the answer.
This algorithm is well-known. I even found mention of it in an ancient Funk & Wagnall Encyclopedia. I merely offer suggestions for streamlining the method for ease of calculation.
The months and weekdays have serial identifications as follows:
| MONTH CODE | |||
| January | 0 | July | 6 |
| February | 3 | August | 2 |
| March | 3 | September | 5 |
| April | 6 | October | 0 |
| May | 1 | November | 3 |
| June | 4 | December | 5 |
| DAY CODE | |
| Saturday | 0 |
| Sunday | 1 |
| Monday | 2 |
| Tuesday | 3 |
| Wednesday | 4 |
| Thursday | 5 |
| Friday | 6 |
For each month, its code simply reflects the prior month's
code, plus the number of days in the prior month in excess of
28. January has 31 days, or
This is the magic formula:
| + MONTH CODE |
| + DAY of month |
| + YEAR (use last two digits only) |
| + YEAR ÷ 4, drop the remainder |
| -1 if January or February of a leap year |
| +1 for dates in the 1900's * |
| Divide the total by 7 |
| Remainder = DAY CODE |
That's all there is to it. Here are some examples:
| May 10, 2005 | |
| Monthcode | 1 |
| Day of month | 10 |
| Year | 5 |
| Year div 4 | 1 |
| Total | 17 |
| 17 ÷ 7, remainder | 3 |
| Daycode 3 = TUESDAY | |
| June 13, 1951 | |
| Monthcode | 4 |
| Day of month | 13 |
| Year | 51 |
| Year div 4 | 12 |
| Century adjust | 1 |
| Total | 81 |
| 81 ÷ 7, remainder | 4 |
| Daycode 4 = WEDNESDAY | |
That wasn't too difficult, and we got the correct
answers. The process can be made even easier, however.
Notice that, at the end, we are interested only in the
remainder; the number of 7's taken out
is immaterial. This means that we can keep our numbers small
by "casting out" 7's during the calculation!
Moreover, when working in modulus 7, the value 6 is equivalent to
Let's try a more efficient approach to the second example, by removing multiples of 7 at every opportunity:
| June 13, 1951 | |||
| value | adjustment | total | |
| Monthcode | 4 | 4 | |
| Day of month | 13 | −1 (or +6) | 3 |
| Year | 51 | +2 | 5 |
| Year div 4 | 12 | −2 (or +5) | 3 |
| Century adjust | +1 | 4 | |
| Daycode 4 = WEDNESDAY | |||
This systematic compression enables the running total to be
kept to 6 or less at all times, thereby reducing the mental
effort. Of course, knowing the multiples of seven is very
handy as well!
It also is helpful to file away in memory the combined code
for the current year, which makes short work of any same-year
calculation. The code for 2004 is 5: 4 for the year, plus 1
for the leapyear adjustment. So,
Happy dating!
* To go back past the last year of a century (such as 2000), add 2; to go forward into the last year of a century, subtract 2. Change the 2 to a 1 if the end-of-century year being crossed is a leap year (that is, evenly divisible by 400) such as 2000 (yes, year 2000 was in the 20th century). In short, add 1 for years 19xx; subtract 2 for years 21xx.
Ted's World
mental arithmetic
mathematical recreations
perpetual calendar
mental date calculation