'2010/04/27'에 해당되는 글 1건

  1. 2010/04/27 년/월/일 로부터 요일 구하기 (2)
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

Trackback Address :: http://seirion.com/trackback/170 관련글 쓰기

댓글을 달아 주세요

  1. |꼬마늑대| 2010/04/28 12:43 Address Modify/Delete Reply

    오오.. 이런 방법이. 이거 좋네.