HOW'S IT CALCULATED?
Ever wonder how the infamous "They" go about generating perpetual calendars. Well, wonder no more. To calculate the day on which a date falls, use the following method:
Compute the values a ,m , and y as follows
Then for the Julian calendar (used from 1 January 45 B.C. until 4 October 1582 B.C.E) calculate the following
Note that mod 7 represents a modulo 7 calculation. The modulo of a number is generated by dividing the number by the modulo base (in this case 7) and reporting what's left over (the remainder of the division). So the result of a
mod 7 (50) = mod (50/7) = 1 (since 50/7 = 7 with a remainder of 1)
Then for the Gregorian Calendar (used from 15 October 1582 A.D. * )
NOTE:
 All divisions are integer divisions; remainders are thrown out
 The value of d represents the days of the week as follows:
0 =

Sunday

4 =

Thursday

1 =

Monday

5 =

Friday

2 =

Tuesday

6 =

Saturday

3 =

Wednesday




*11 days were added to the year in 1582, so 4 October was followed by 15 October.
Example. If you want to know what day of the week June 4, 1998 fell on, you'd calculate it as follows:
GIVEN:
CALCULATIONS:
 a = (14  6)/12 would normally equal 8/12, but since this is an integer division, the result of the division is 0 with a remainder of 8 . . . and since in integer division we throw out remainders,a = 0
 m =6 + 12(0)  2 = 4
 y = 1998  0 = 1998
 d = mod 7 [ 4 + 1998 + 1998/4  1998/100 + 1998/400 + {31(4)}/12 ]
 d = mod 7 [ 4 + 1998 + 499  19 + 4 + 10 ] Remember: all divisions are integer divisions
 d = mod 7 [ 2501  19 + 14 ]
 d = mod 7 [ 2501  4 ]
 d = mod 7 [ 2496 ]
 2496/7 = 356 with a remainder of 4. So . . .
 d = 4 which we see from the table means Thursday
If you check with a 1998 calendar, you'll see that this is correct.
Return to Top
Back to Science/Math Page
