Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!rutgers!gauss.rutgers.edu!math.rutgers.edu!aberg From: aberg@math.rutgers.edu (Hans Aberg) Newsgroups: comp.misc Subject: Re: Need calendar algorithms Message-ID: Date: 30 Dec 88 21:50:27 GMT References: <101150003@hpcvlx.HP.COM> Organization: Rutgers Univ., New Brunswick, N.J. Lines: 42 The easiest way to compute the time difference between two dates, and also the date for recurrent phenomena, is to convert the dates into the astronomical Julian Day Number. Here are the rules for those: Rules for computing the Julian day number, used in astronomy: 1. Day 0 = Jan. 1, 4713 B.C., a leap year. (In astronomy, this is the time at 12 PM in Greenwich, with the decimals giving fractions of the day.) 2. Every fourth year, until Oct.4, 1582, is a leap year. After this date the exception 5. below is made. 3. There is no year zero. (In astronomy, year 0 = 1 B.C.) 4. Oct.4, 1582, is directly followed by Oct.15, 1582 (ten days missing), when the Gregorian calendar was introduced. 5. After Oct.15, 1582, the full hundred years 1600, 1700, 1800, and so forth, are only leap years when divisible by 400. 6. Day of week is given by Julian day number modulo 7, Monday = 0, Sunday = 6. These rules, and many others, are to be found in a book, with a title something "... calendars ... ephemeral times ...". Check the reference section in a research library. Hewlett-Packard algorithm, from HP67 manual: Dates between March 1,1900,and February 28, 2100. y' := year-1 if month = 1 or 2 year otherwise. m' := month+13 if month = 1 or 2 month+1 otherwise. d := day. Julian Day # = int(365.25ay')+int(30.6001am')+d+1720982. Hans Aberg Mathematics, Rutgers University