Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!linus!security!genrad!grkermit!masscomp!clyde!floyd!harpo!ihnp4!inuxc!pur-ee!uiucdcs!parsec!ctvax!uokvax!lmaher From: lmaher@uokvax.UUCP Newsgroups: net.followup Subject: Re: Date Algorithm - (nf) Message-ID: <5070@uiucdcs.UUCP> Date: Sun, 22-Jan-84 22:57:32 EST Article-I.D.: uiucdcs.5070 Posted: Sun Jan 22 22:57:32 1984 Date-Received: Fri, 27-Jan-84 04:53:22 EST Lines: 23 #R:sequent:-33700:uokvax:2700015:000:661 uokvax!lmaher Jan 21 15:25:00 1984 (posting from a friend's account while uok is down) For calculating the day of the week, here's Zeller's Congruence: F = (int((26*m-2)/10) + k + d + int(d/4) + int(c/4) - 2*c) mod 7 F=0 is Sunday, F=1 is Monday, and so on k is the day of the month, c is centuries, d is year in the century, m is the month starting with March as 1, April as 2, on to February as 12. int(x) is the largest integer smaller than x, of course. Example: 8/20/1982 - k=20,c=19,d=82,m=6 F= (int(15.4) + 20 + 82 + int(20.5) + int(4.75) - 38) mod 7 = (15+20+82+20+4-38) mod 7 = 103 mod 7 = 5 so August 20, 1982 was a Friday. Carl ..!uokvax!uok!crigney ..!duke!uok!crigney