Many times people ask questions about dates, since dates are not 
  readily obvious. Some of these questions might be:
In what years is the Fourth of July on a Wednesday?
  In what months this year is the 13th of the month on a Friday?
  When is the third Thursday of August, 2013?
  On what day of the week was 1969 July 20?
  On what day of the month is the next Sunday after 2013 March 27?
Most people when confronted with these questions will consult 
  a calendar. However there are several ways of finding it without using a calendar 
  or notes. One of these is based on this formula:
W = Y + M + D (mod 7)
where W is the number of the day of the week, Y is the Doomsday 
  Number of the year, M is the number of the month,D is the day of the month (e.g., on the 4th of the month, D = 4), and "mod 
  7" means we throw out all 7s in the calculation, so for example, 19 = 5, 
  because their difference, 14 = two 7s, which we throw out. In this formula we 
  always take remainders on division by 7.
Let's explain each of these in detail. Y is the Doomsday number of the year, 
  and is based on the Doomsday 
  Rule, which shows how to compute the Doomsday of a year CA, where C is the 
  century, and A is the year of the century; e.g., for 2013, C = 20 and A = 13.
1. Divide A by 12, getting a quotient and remainder. Divide the remainder by 
  4 and take the quotient. Add both quotients together and take the remainder 
  upon division by 7. Example, 2018. 19 divided by 12 yields 1 
  with a remainder of 6. 6 divided by 4 gives a quotient of 2. 
  1 + 6 + 2 = 9, which leaves a remainder of 2 when divided by 
  7.
  2. Divide C by 4 giving a remainder of r. Then the Doomsday number is 3 - 2 
  x r. If this is negative, add 7 over and over again until it is positive. For 
  2013, 20 divided by 4 yields a remainder of 0, so compute 3 - 2 x 0 = 3. Or 
  as John Horton Conway puts it: for Quadrennial centuries take Tues., and for 
  every century after that, go back by twos.
The numbers correspond to the days of the week according to this table:
| Sunday | 1 | 
| Monday | 2 | 
| Tuesday | 3 | 
| Wednesday | 4 | 
| Thursday | 5 | 
| Friday | 6 | 
| Saturday | 7 | 
For 2013, this yields Thursday, so the year number Y = 5.
M is the month number. That is given by this table:
  | 0 | February(common year),March,November | 
| 1 | June | 
| 2 | September,December | 
| 3 | April,July,(leap year)January | 
| 4 | January(common year),October | 
| 5 | May | 
| 6 | August,(leapyear)February | 
It is best to remember the 12-number string (we do something like this all 
  the time with telephone numbers and credit card numbers) 400-351-362-402, and 
  change 400 to 360 in leap years. Or you can remember the 7 categories of months:
Here is an example date. 1969 July 20. 69 divided by 12 yields 5 with a remainder 
  of 9; 9 divided by 4 gives a quotient of 2. 5 + 9 + 2 = 16; remaider after dividing 
  by 7: 2. The 1900s are 3 centuries past the Quadrennium (1600s), so take 2 x 
  3 = 6 days before Tuesday and get Wednesday. 2 days past Wednesday is Friday, 
  so the Doomsday of 1969 is Friday, and the Doomsday Number Y = 6. The month 
  number M of common year July is 3, and the day number is 20. So we compute the 
  weekday number as:
W = Y + M + D (mod 7)
 = 6 + 3 + 20 = 29 = 1 after throwing out the 7s
So 1969 July 20 was a Sunday. That's the day Neil Armstrong landed on the Moon, 
  so the Moon is a Sunday World.
The equation W = Y + M + D (mod 7) has four variables. If any three are known, 
  the fourth can be computed. This leads to four different types of date questions.
Type 1. Y is unknown. We know the month and days of the month and week and 
  want to find the year. A typical question might be "In which year is April 
  4 on a Tuesday?" The equation is Y = W - M - D (mod 7). A real world example 
  would be if someone found an old document marked "Tuesday, April 4" 
  but the year doesn't appear anywhere. Then this formula gives the Doomsday number 
  of the year. It then remains to search years to find which one has this Doomsday. 
  One can count through the years, adding 1 for each common year and 2 for each 
  leap year.
Type 2. M is unknown. We know the year, day and day of week but want to find 
  the month. An amusing example is to find out when all the Friday the 13ths of 
  the year occur. The equation is M = W - Y - D (mod 7).
Type 3. D is unknown. We know the year and month, and the weekday, but not 
  the day of the month. This appears commonly in finding out when meetings and 
  certain holidays occur.The formula is D = W - Y - M (mod 7). For example, in 
  finding out when the third Thursday of August 2013 is, 2013's Doomsday is Thursday, 
  which has value 5, and August's value is 6. So compute D = W - Y - M = 5 - 5 
  - 6 = -6 = 1, when we add 7. This just tells us that August 1 is Thursday, and 
  so is the first Thursday of the month. The third Thursday is obtained by adding 
  14 to this: August 15.
Type 4.W is unknown. We know the date but not the day of the week. The formula 
  is W = Y + M + D (mod 7).
Most date questions fall in these four types. One that doesn't is "What 
  day of the month is the next Sunday after 2013 March 27?". One could ask 
  what day of the week is 2013 March 27. That's a Type 4 question. Then one can 
  figure from that when the next Sunday is. 
The things to remember with this system are the Doomsday Rule and the month 
  numbers. Then you can tell what day of the week any date is, as well as answer 
  many other date questions.