Method 2
For a day of the day / year / year where "day" takes a value of 01 to 31, "month" from 01 to 12 and "year" from 1583 to 9999, use the formula:
c = (14 - months) / 12
In fact, c = 1 for January and February, c = 0 for the other months.
y = year - c
m = month + 12 * c - 2
d = (day + y + y / 4 - y / 100 + y / 400 + (31 * m) / 12) mod 7
The answer obtained for d then corresponds to a day of the following week:
0 = Sunday, 1 = Monday, 2 = Tuesday, etc.
Remarks
In all divisions "/", only the whole part of the result is kept. For example, 35/4 = 8.
Finally, mod 7 means "division by 7", it is "the result is the rest of the division by 7".
(For example, 23 mod 7 = 2, because the rest is 2.)
Example
What day is March 13, 2004?
On the calculation c, y and m:
c = (14 - 3) / 12 = 0, y = 2004 - 0 = 2004 and m = 3 + 12 * 0 - 2 = 1.
We then find:
d = (13 + 2004 + 2004/4 - 2004/100 + 2004/400 + (31 * 1) / 12) mod 7
d = (13 + 2004 + 501 - 20 + 5 + 2) mod 7
d = 2505 mod 7 = 6 (for 2505/7 = 357 and the remaining is 6.)
So March 13, 2004 was a Saturday

1 Comment

S

S O

said
7 months ago

(Where did the Like button go?) I appreciate you sharing!

## Terii

`Method 2 For a day of the day / year / year where "day" takes a value of 01 to 31, "month" from 01 to 12 and "year" from 1583 to 9999, use the formula: c = (14 - months) / 12 In fact, c = 1 for January and February, c = 0 for the other months. y = year - c m = month + 12 * c - 2 d = (day + y + y / 4 - y / 100 + y / 400 + (31 * m) / 12) mod 7 The answer obtained for d then corresponds to a day of the following week: 0 = Sunday, 1 = Monday, 2 = Tuesday, etc. Remarks In all divisions "/", only the whole part of the result is kept. For example, 35/4 = 8. Finally, mod 7 means "division by 7", it is "the result is the rest of the division by 7". (For example, 23 mod 7 = 2, because the rest is 2.) Example What day is March 13, 2004? On the calculation c, y and m: c = (14 - 3) / 12 = 0, y = 2004 - 0 = 2004 and m = 3 + 12 * 0 - 2 = 1. We then find: d = (13 + 2004 + 2004/4 - 2004/100 + 2004/400 + (31 * 1) / 12) mod 7 d = (13 + 2004 + 501 - 20 + 5 + 2) mod 7 d = 2505 mod 7 = 6 (for 2505/7 = 357 and the remaining is 6.) So March 13, 2004 was a Saturday`