Wednesday, December 15, 2010

Find-out weekday from a given date

-----------------------
MONTH CODES
-----------------------
Jan – 6 .For leap year - 5
Feb – 2 .For leap year - 1
Mar – 2
Apr – 5
May – 0
Jun – 3
Jul – 5
Aug -1
Sep – 4
Oct – 6
Nov -2
Dec -4

The Basic Steps

The basic steps for a date in the years 2000-2099 are as follows:
Example date July 13th, 2004
1.Take the last 2 digits of the year and add a quarter onto itself. (04 + 1 = 5) ignore the decimals.

2.Get the corresponding code for the month. (January = 6, February = 2, March = 2, etc. See month codes for details). July = 5

3.Take the day. (=13)

4.Add the numbers together (5 + 5 + 13 = 23)

5.Take away 7 (or multiples of 7) until a number from 1-7 is left. (23 - 21 =2)

6.This number corresponds to the day of the week. (1 = Monday, 2 = Tuesday, etc.) In this case 2 = Tuesday

Try it………….

2 comments: