Computing the day of the week
The Algorithm
The algorithm is as follows (works for dates 2000-2099):
1. Take the last two digits of the year, and divid it by four (ignoring anything after the decimal)
2. Add the number in step 1 to the last two digits of the year
3. Add the day of the month to the number in step 2.
4. Add the number from the month table below to the number in step 3
5. If the year is a leap year (see below), then subtract 1 if the date is on or before Feb 29
6. Subtract 7 from the number until it is in the range 1-7.
7. For the number you obtained in step 6, 1=Monday, 2=Tuesday, ... 7=Sunday

More Detail
This is a method for computing the day of the week for any date which can be done in your head. This method requires you to memorize the table below, which shouldn't take that long (took me about 20 minutes). Then you'll need to practice every now and then to keep it fresh. This is the simplest method I've seen for dates in the 2000s.

Since This algorithm is designed for computing the day of the week in your head, it doesn't adapt well if you want to compute the day of the week programatically. If that's what you're looking for, then a Google search for Zeller's Congruence will yeild a sutable algorithm.

For example: Feb 10, 2004
1: The last two digits are 04, 04 / 4 = 1.
2: 04 + 1 = 5.
3: 5 + 10 = 15.
4: The entry for Feb is 2 in the table below, 2 + 15 = 17.
5: This is a leap year, and it's before Feb 29, so 17 - 1 = 16.
6: 16 - 7 - 7 = 2.
7: 2 corresponds to Tuesday.

Here is the table which must be memorized. Plug in these numbers for the months in the formula:
Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec
6 2 2 5 0 3 5 1 4 6 2 4

For centuries other than 2000s, you must apply a century correction factor:
1700s 1800s 1900s 2100s 2200s
+5 +3 +1 -2 -4

Rules for determining leap years:
If the year is divisible by 400, it is a leap year
If the year is divisible by 100, but not 400, it is NOT a leap year
Otherwise, if the year is divisible by 4, it is a leap year


Practice
Generate dates between and

Find the day of the week for: and click the corresponding button below.

Result:

Tips and Tricks
  • At any point after step #2 you can subtract off multiples of 7 so that you can work with smaller numbers. So instead of adding 9+18, you can subtract 7 from the nine, and 14 from the 18 and just add 2+4. Note that you can only do this AFTER STEP #2.
  • You don't have to do the steps in order. If you find it easier to work from left to right on the numbers in the date that's fine.
  • The numbers in the month table you have to memorize follow a bit of a pattern when you realize that multiples of 7 have been subtracted off. The value for the next month differs by either 0, 2, or 3 then seven is subtracted if the resulting number is greater than seven. The month after a month with 31 days adds 3 to the month's value, a month after a month with 30 days adds 2 to the month's value, and a month with 28 days adds 0. For example, April's number is 5, and April has 30 days, so the number for May would be 5+2=7 and subtract off 7 leaving 0.
  • You can add multiples of 7 to the numbers in the month table if it makes it easier to memorize. For example the number for December is 4, but you can add 21 to that to make it 25, and we all know Dec 25 is Christmas so that should be easier to relate to December than just the number 4. The downside is you'll be working with larger numbers, but you can immediatley subtract off the multiple of seven to get it down to a number easier to work with.
  • If you find it confusing to have Sunday as the last day of the week, just remember than you can always subtract off multiples of 7 and make Sunday = 0.
  • When substracting off multiples of 7, the result doesn't always have to be a possitive number, you just need to end result to be between 1 and 7. For example, when computing the day for Jan 20 2005 you might find it easier to work with -1 than 20.
  • Even though there's no direct way to compute an answer for a question such as "What is the first Tuesday in November", you can do so indirectly by calculating the day of the week for the first of November, then counting days from there. You can also get things like "The third wednesday in November" by just guessing at a date that's close. You should know that the third anything in a month will be between the 14th and the 21st, likewise the second anything will be between the 7th and 14th, etc.

How It Works
The mathematics behind this algirhtm aren't that complicated, you could probably easily figure it out on your own.
Step 1,2: You may already know that for a given date, the same date one year later will be one day later in the week. Except for leap years, in which case the date is two days later in the week. For example, Jan 1 2001 was a Monday, while Jan 1 2002 was a Tuesday (one day later in the week). In step 2, you use the last two digits of the year, so with just that, you're automatically moving one day ahead in the week for each year. Every time a leap year rolls around you end up adding another one because in step one you divide by four and add that to the year, so this accounts for the two day jump in leap years.
Step 3: For each day of the month, you move ahead one day in the week, which should be pretty obvious.
Step 4: This is the only tricky part. The table is computed for the year 2000 and is just computed to force the algorithm to work for that year. All other steps (except step 5) are just to make it work for other years. Note that for the year 2000, you're adding zero for steps one and two.
Step 5: Since dates move two days further in the week in leap years, you added another 1 in step 1. But before Feb 29, the dates are still only one day later, so you have to back up a day so everything works out.
Step 6: This should be fairly obvious. Since the days of the week repeat every seven days you can subtract off multiples of seven to get it into a range which you can easily memorize.
Century Correction Step: This accounts for the fact that the tables are computed for the year 2000. You could apply the correction factors to the month table and memorize that new table to compute dates for that century without applying a correction factor. Note that for each century beyond 2000, you substract two. So this table can be extended out to infinity in each direction, but note that for centuries divisible by 400, you only subtract one (e.g. from 1900 to 2000 the factor goes from +1 to +0, a difference of only one).