Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Posting-Version: version B 2.10.1 (Tek) 9/26/83; site orca.UUCP Path: utzoo!linus!philabs!seismo!harpo!ihnp4!zehntel!tektronix!orca!rogerc From: rogerc@orca.UUCP (Roger M. Christal) Newsgroups: net.general Subject: Re: Date Algorithm Message-ID: <486@orca.UUCP> Date: Thu, 19-Jan-84 14:45:53 EST Article-I.D.: orca.486 Posted: Thu Jan 19 14:45:53 1984 Date-Received: Sat, 28-Jan-84 02:35:02 EST Organization: Tektronix, Wilsonville OR. Lines: 43 Here is the algorithm for computing the day of the week for any given date (in this century at least). First, each month is given a number value. January = 1 July = 0 February = 4 August = 3 March = 4 September = 6 April = 0 October = 1 May = 2 November = 4 June = 5 December = 6 When doing the calculation for a leap year, remember to subtract 1 from January or Febuary dates. Add: the year (modulo 1900 or whatever; 1953 means 53) the INT(year/4) (again; 1953 means 53; INT(53/4) = 12) day of month month code (as above) Divide the above answer by 7 and use the remainder as the day of the week; Saturday = 0. Day Of Week = MOD7 ((year) + INT (year / 4) + (day of month) + (month code)) Example: I was born on Easter Sunday, 1947. The date is April 6. year + INT(year/4) + day + month code 47 + 11 + 6 + 0 = 64 MOD7 (64) = 1, or Sunday! Mugs Away, Mate! - - - - - - - - - - - - - - - - - \\\\\\ _________ Doctor Dart - - - - - - - - - - >>>>>>----==(_________)----- - - - - - - - - - - - - - - - - - ////// ..!decvax!tektronix!orca!rogerc