This article details various mathematical algorithms to calculate the day of the week for any particular date in the past or future.
A typical application is to calculate the day of the week on which someone was born or some other special event occurred.
Contents |
The basis of nearly all the algorithms to calculate the day of the week is:
Put simply, using arithmetic modulo 7 means ignoring multiples of 7 during calculations. Thus we can treat 7 as 0, 8 as 1, 9 as 2, 18 as 4 and so on; the interpretation of this being that if we signify Sunday as day 0, then 7 days later (i.e. day 7) is also a Sunday, and day 18 will be the same as day 4, which is a Thursday since this falls 4 days after Sunday. Some algorithms do all the additions first and then cast out sevens whereas others cast them out at each step. Either way is quite permissible; the former is better when using calculators and in computer algorithms, the latter for mental calculation (it is quite possible to do all the calculations in one's head with a little practice).
"Corresponding months" are those months within the calendar year that start on the same day. For example, September and December correspond, because September 1 falls on the same day as December 1. Months can only correspond if the number of days between their first days is divisible by 7, or in other words, if their first days are a whole number of weeks apart. For example, February corresponds to March because February has 28 days, a number divisible by 7, 28 days being exactly four weeks. In a leap year, January and February correspond to different months than in a common year, since February 29 means each subsequent month starts a day later.
Here's how the months correspond:
Note that in the months table below, corresponding months have the same number, a fact which follows directly from the definition.
There are seven possible days that a year can start on, and leap years will alter the day of the week after February 29. This means that there are 14 configurations that a year can have. All the configurations are referenced in the article on Dominical letter. For example, 2007 is a common year starting on Monday, meaning that 2007 corresponds to the 2001 calendar year. 2008, on the other hand, is a leap year starting on Tuesday, meaning that the year starts off corresponding to 2002 and ends corresponding to 2003.
The algorithm is valid for the Gregorian calendar. Britain and its colonies started using the Gregorian calendar on September 14, 1752. The areas now forming the United States adopted the calendar at different times depending on the colonial power; Spain, France, Italy, and others had started using it in 1582, while Russia still had not done so by 1867 when U.S. purchased Alaska.
This algorithm shows how to come up with four numbers. Find the sum of these four and using modulus to restrict the result to 0 through 6, the day of the week can be determined. Since this algorithm uses the "zeroth" day, we can add the day of the month directly (without subtracting 1). Examples of the evaluation of this algorithm are below. The four numbers are:


Now for an example of the complete algorithm, let's use April 24, 1982.
Now let's try September 18, 1783.
Let's try leap year
January 1, 2000
Finally, let's try June 19, 2054
1700–1799 4 (Still Julian Calendar in Great Britain and its colonies until 1752) 1800–1899 2 1900–1999 0 2000–2099 6 2100–2199 4 2200–2299 2 2300–2399 0 2400–2499 6 2500–2599 4 2600–2699 2
January 0 (in leap year 6) February 3 (in leap year 2) March 3 April 6 May 1 June 4 July 6 August 2 September 5 October 0 November 3 December 5
Sunday 0 Monday 1 Tuesday 2 Wednesday 3 Thursday 4 Friday 5 Saturday 6
One can add constants (modulo 7) to these three tables provided the constant you add to the day table is equal to the sum of the constants you add to the centuries table and the months table modulo 7.
A method useful for mental calculation imagines the year starts on March 1 rather than January 1 (as it did in Roman times), so that the extra day in a leap year is the last day, rather than occurring in the middle of the year. This removes the need to do different calculations for a leap year. It leads to, "day 0" described above being the last day of February.
April 4, June 6, August 8, October 10 and December 12 all occur on the same day as day 0 (note that April is the 4th month, June the 6th, August the 8th, etc).
May 9 and September 5 are also the same day as day 0 (May is the 5th month and September the 9th — think of the Dolly Parton song "9 to 5": the 9th day of the 5th month and the 5th day of the 9th month).
July 11 and November 7 are the same day as day 0 (the 7th and 11th months, respectively — think of the 7-Eleven shops).
These days of the week are called Doomsdays in the Doomsday algorithm, which uses these very same mnemonics.
However, if one regards the new year as beginning on March 1 one has a simpler situation for February and January. Day 0 occurs on January 16 and February 6, which are the same day of the week as the previous last day of February (i.e. last year's Doomsday) for every year.
Also within each year beginning March 1, five months is always exactly 153 days and hence one day short of a whole number of weeks. This gives rise to the following dates for day 0:
| Month | +5 months | −5 months | +10 Months |
|---|---|---|---|
| April 4 | September 5 | February 6 | |
| June 6 | November 7 | ||
| August 8 | January 9 | March 7 | |
| October 10 | May 9 | ||
| December 12 | July 11 |
So if you can figure out what day "day 0" is, you can quickly find a date in any month that falls on the same day, and you only have to add or subtract a few days to get to any other day in the month.
First memorize this: in 2000, day 0 was a Tuesday. Every century, day 0 changes according to the following pattern: Tuesday, Sunday, Friday, Wednesday every 100 years; i.e., in 2100 day 0 will be Sunday; in 1900 it was Wednesday.
Every common year, day 0 moves forward one day, and two days every leap year.
The following also apply within any century beginning with a year ending with 00:
So let's say it is desired to know what day June 3, 2017 will be. Day 0 for 2000 was a Tuesday, in 2012 it will be Wednesday, 2013 will be Thursday, 2014 Friday, 2015 Saturday, 2016 (a leap year) Monday, and 2017 Tuesday; June is the 6th month, so the 6 June is a Tuesday. Three days earlier is Saturday.
In Zeller’s algorithm the months are numbered from 3 for March to 14 for February. The year is assumed to begin in March; this means, for example, that January 1995 is to be treated as month 13 of 1994.
The system of dominical letters assigns a letter from A through G to each day of the year. In a leap year, February 24, the bissextile day, does not have a distinct letter. This causes all subsequent Sundays to be associated with a different dominical letter than those in the beginning of the year, so all leap years get two dominical letters. In this system, the "dominical letter" for a year is the letter which corresponds to the Sundays of that year.
|
||||||||||||||||||||||||||||||||||
|
|