The Algorithm
|
|
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 Here is the table which must be memorized. Plug in these numbers for the months in the formula:
For centuries other than 2000s, you must apply a century correction factor:
Rules for determining leap years:
|
|
Practice |
Tips and Tricks
|
|
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). |