W = (k + floor(2.6m - 0.2) - 2C + Y + floor(Y/4) + floor(C/4)) mod 7                   [1]

k is day (1 to 31)
m is month (1 = March, ..., 10 = December, 11 = Jan, 12 = Feb) Treat Jan & Feb as months of the preceding year
C is century (1987 has C = 19)
Y is year (1987 has Y = 87 except Y = 86 for Jan & Feb)
W is week day (0 = Sunday, ..., 6 = Saturday)


이걸 이용해서 잘 해 보면 다음과 같이 c 코드를 만들 수 있다.



reference :
[1] How to determine the day of the week, given the month, day and year
http://www.mcs.csueastbay.edu/~malek/Mathlinks/Weekdays.html
: