How Do You Calculate Days Of The Week Like Rainman?
• First we need a number for every day of the week: • Monday is, 1 • Tuesday is, 2 • Wednesday is, 3 • Thursday is, 4 • Friday is, 5 • Saturday is, 6 • Sunday is, 0 or 7 • Have a number for every month: • January is, 6* • February is, 2* • March is, 2 • April is, 5 • May is, 0 • June is, 3 • July is, 5 • August is, 1 • September is, 4 • October is, 6 • November is, 2 • December is, 4 • For a Leap Year * January is 5 and February is 1 but that will be explained shortly. • Have a code for every year, which is simple as well but for now let’s put it together and see the formula at work: • Let’s use Christmas 2009; • December Month Code (4) + Day (25) + Year Code (4), which is: (4 + 25 + 4) = 33. • Now get as close to the 33 as you can with multiples of seven, subtract the difference and then use the remainder for the week code, (7 * 4) = 28, then (33 – 28) = 5, and that’s it, five is the day code for Friday, so Christmas day this year will occur on a Friday. • Before we go any further let