Day of Week -- A program for converting Gregorian dates in the form month-day-year to day of the
week is the following. Let the Gregorian date be represented by M/D/Y where we have the following
definitions:
M is the month of the year. Let m be the month number derived from M by the rule m is M-2
if M>=3 and m is M + 10 otherwise.
d is the day of the month.
y is the year of the century.
c is the number of the previous century.
The algorithm is as follows:
(a) A is the integer part of (13m - 1)/5.
(b) B is the integer part of y/4.
(c) C is the integer part of c/4.
(d) D = A + B + C + d + y - 2c.
(e) Make R equal to the remainder of D/7.
(f) Interpret R as Sunday if R = 0, Monday if R is 1, etc.