This is a method to find the day of the week for any date between Julius Caesar and the apocalypse, or at least until someone changes the Western calendrical system. You can also use this system, for example, to find the next Friday the 13th. I learnt it by heart years ago, and I never needed to use a calendar since that time.

You need to compute the sum of 4 numbers: one for the century, one for the year in the century, one for the month, and one for the day in the month.

All these numbers are defined modulo 7. For example, 5 is equivalent to 12 and to -2.

Step 1: the Century Number

The Century Number is not really a century number, since it considers that 1900 belongs to the 20th century, that 2000 belongs to the 21st century, and so on.
The computation mode for the Century Number is different in the Gregorian calendar and the Julian Calendar. The Gregorian calendar was introduced by Pope Gregory XIII in the year 1582, but it was adopted by other countries later. For example, the British adopted it only in September 1752, which you can check by typing cal 9 1752 under Unix.

  • In the Julian calendar, the Century Number is 0 (zero) for years that begin with 4, 11 or 18 (i.e in the 5th, 12th or 19th century). For years in other centuries, compute the difference with the next century with a Century Number equal to 0:
    Year 1752: 18 - 17 =  1
    Year 234: 4 - 2 = 2
  • In the Gregorian calendar, the Century Number is 0 for the 20th century. The following table gives the Century Number for other centuries. If you want to memorize it, or find the day of week for years in the 4th millenium, you may note that there is a pattern (hint: 1600 and 2000 are leap years, while 1700, 1800, 1900 and 2100 are not. See Gregorian calendar.)
                        The Century Number
    
       Years that begin with           Century Number
                        15..           0
                        16..           1
                        17..           3
                        18..           5
                        19..           7 = 0 mod 7
                        20..           1
                        21..           3
                        22..           5
                        23..           7 = 0 mod 7
                        24..           1
    
Step 2: the Year Number

For the Year Number, the easiest way is to start from years which Year Number is 0. Then walk to your year, and add 1 for each non-leap year you encounter, and 2 for each leap year.
The following years have a Year Number equal to 0 (hint: find the pattern if you want to learn this list by heart):

             The Year Number

                00    04    10
          21    27    32    38
          49    55    60    66
          77    83    88    94

Year 1399 has a Year Number equal to 5 = 99 - 94 + 1 (because there is one leap year, 96, in the interval)
Year 1956 has a Year Number equal to 2 = 56 - 55 + 1 (because 56 is a leap year)
Year 44 BC has a Year Number equal to 3 because 44 BC is equivalent to 57 in 1st century BC, and 57 - 55 + 1 = 3.

Step 3: The Month Number

This is the Month Number for each month:

                 The Month Number

          0   February (leap year), August
          1   February (non-leap year), March, November
          2   June
          3   September, December
          4   January (leap year), April, July
          5   January (non-leap year), October 
          6   May
Step 4: the Day Number

Congratulations, this is the end. The Day Number is simply, well, the day number in the month: 17 if this is November 17th, for instance.

Putting it all together

The sum of the previous numbers, modulo 7, gives the day of the week. 0 means Sunday, 1 means Monday, and so on.

A few examples:

   ============================================================
   Date
     Century Nb   Year Nb   Month Nb   Day Nb   Result
   ============================================================
   November 17, 2000
         1           0         1         17     19 = 5 mod 7
                                                   => Friday
   	
   September 2, 1752 (Julian calendar)
         1           4         3          2     10 = 3 mod 7
                                                   => Wednesday
   
   September 14, 1752 (Gregorian calendar)
         4           4         3          14    25 = 4 mod 7
                                                   => Thursday
   
   March 15 44BC
        -5           3         1         15     14 = 0 mod 7
                                                   => Sunday
   
   July 1st 1969
         0           4         4         21     29 = 1 mod 7
                                                   => Monday
   ============================================================

Another example: how many Friday the 13ths are there in year 2000?
Solution: Friday is 5. Subtract the day number 13, the year number 0 and the century number 1 from 5. The result is:

5 - 13 - 0 - 1 = -9 = 5 mod 7

The corresponding month is October (not January because 2000 is a leap year.)