Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!zaphod.mps.ohio-state.edu!swrinde!ucsd!ucbvax!van-bc!balden From: balden@van-bc.wimsey.bc.ca (Bruce Balden) Newsgroups: comp.databases Subject: Re: Calendar Algorithm Message-ID: <1424@van-bc.wimsey.bc.ca> Date: 14 Aug 90 20:24:08 GMT References: <3091.26c69b52@cc.curtin.edu.au> Reply-To: balden@van-bc.UUCP (Bruce Balden) Organization: USENET Public Access, Vancouver, B.C., Canada Lines: 31 Keywords: > SUBROUTINE JULIAN(D1,M1,Y1,D2,M2,Y2,F,J2,W2,T2) >C ALGORITHM DERIVED FROM HART: SOFTWARE - PRACTICE AND EXPERIENCE >C Julian conversion and inverse -- takes into account >C J2, the Julian date, is the exact number of days since >C D-M-Y, the Gregorian calendar, was adapted in the United Most elegant calendar algorithms depend on the fact that the calendar is much more regular if years are viewed as beginning in March, i.e. the zero'th day of the year is March 1 and the last day of the year is Feb 28 or 29. This allows the simple formula floor(30.6*MONTH+0.5) to calculate the day displacement. This "simple" formula can be complicated a little to avoid floating point arithmetic. On this simple observation and the idea of using Julian day numbers hang all elegant calendar algorithms. The usefulness of this approach is no accident: The year orginally really did begin on March 1. Look at the names of the months of the year: November "ninth month", September "seventh month", etc. Bruce Balden Grand Thaumaturge. Have a nice one.