dal@syntel.UUCP (Dale Schumacher) (07/21/89)
[jms@tardis.Tymnet.COM (Joe Smith) writes...] > In article <061089A1311@syntel.UUCP> dal@syntel.UUCP (Dale Schumacher) writes: > < return( ((146097L * c) >> 2) + > < ((1461L * y) >> 2) + > < (((153L * m) + 2) / 5) + > < d + 1721119L ); > > I love it! One question though, what in the heck is the 1721119 for? > That many days is over 4000 years. That constant should be -68142 if > you want day 1 to be 18-Nov-1858, right? I must admit to not being an expert on date systems, but I don't think that 18-Nov-1858 is supposed to be the base date of the Julian calendar. I found this magic formula in two separate (and apparently unrelated) places, one in BASIC and the other in FORTRAN. The algorithms were slightly different, by they reduced to identical formulae. It has served my purposes well. The base date doesn't really matter much in actual use, since nobody really cares to know "how many days since the Julian base date" but rather "how many days different are these two dates". PS. I received one comment that this was a horribly complex way to determine leap years. I must agree, on the surface, but if this function is already in your library (or should be) for it's numerous other uses, then why not take advantage of it to handle leap years with greater accuracy? \\ / Dale Schumacher 399 Beacon Ave. \\ / (alias: Dalnefre') St. Paul, MN 55104-3527 >< ...umn-cs!midgard.mn.org!syntel!dal United States of America / \\ "What is wanted is not the will to believe, but the will to find out, / \\ which is the exact opposite." -Bertrand Russell
pwp@iuvax.cs.indiana.edu (07/22/89)
The Julian day number is the number of days since 4004 BC or when ever it was that someone calculated that God created the earth. This system was developed by astronomers who need to deal with historical records recorded under different calander systems. Thus someone studying some old record can translate the dates to Julian days and other astronomers who know nothing about the calcander used in the original record can understand the date. 4004 BC is far enough back that all historical records recieve a positive Julian date. Since the current Julian day is a hugh integer, computer programs often use some other starting point, but call the integer day number the Julian day anyway. This practice occasionally leads to confusion.
rec@elf115.uu.net (Roger Critchlow) (07/30/89)
In article <36500066@iuvax>, pwp@iuvax.cs.indiana.edu writes: > > The Julian day number is the number of days since 4004 BC or when ever it was > that someone calculated that God created the earth. The Julian day number counts from Greenwich Mean Noon, January 1, 4713 BC. Given the Julian day number (JD) the formula ((JD + 1.5) remainder 7) gives the day of the week counting Sunday as 0. So Julian day number 0 was a Monday. Hmmm. -- rec --
I0908@DKAFHS1.BITNET (08/08/89)
Date: 08 August 1989, 11:34:56 SET From: Cornelius Caesar BITNET / EARN: I0908 at DKAFHS1 To: info-atari16 at score.stanford.edu <pwp@iuvax.cs.indiana.edu> wrote two weeks ago: > The Julian day number is the number of days since 4004 BC or when ever it was > that someone calculated that God created the earth. This system was developed > by astronomers who need to deal with historical records recorded under > different calander systems. Thus someone studying some old record can > translate the dates to Julian days and other astronomers who know nothing > about the calcander used in the original record can understand the date. 4004 > BC is far enough back that all historical records recieve a positive Julian > date. > ^...! (stuff deleted) This is not quite true. The base date of the Julian day number is Jan. 1, 4713 BC (or -4712 since the year 0 does not exist in the historical year count). And there is of course a reason why Joseph Scaliger (1540-1609) choose this date: (I have to use some specific words which I don't know a correct translation of, thus I give the german original in parentheses. What follows is taken from the book "Bekanntes & Unbekanntes aus der Kalenderwissenschaft" from Heinz Zemanek (IBM Fellow and Prof. at the TU Wien), R. Oldenbourg Verlag, Muenchen 1978; and it's long ...) Sun Circle (Sonnenzirkel) is a cycle of 28 years since every 28 years the same dates are on the same week days throughout the year. (4 leap-year cycle times 7 days per week.) It is defined as SC=(year+9)%28 (% is the remainder operator as in C). I don't know the reason for the +9 offset. Moon Circle (Mondzirkel) is a cycle of 19 years, also called the Meton period, because Meton suggested in 433 BC to use 12 years with 12 months each and 7 years with 13 months (months have 29 or 39 days), after which dates could repeat without too much difference against the astronomy. The Christian church used the Moon circle for the computation of the Easter date. It is also called Golden Number (Goldene Zahl) and is defined as GN=(year+1)%19. These two cycles multiplied give 532 years, the so called Easter cycle, because after that time every Easter sunday would have the same weekday (without considering a slight shift called "Epakte"). The ancient romans had a cycle of 15 years, after which time a new tax count had to be made. It is called "Indiktion" (from latin: indictio, decree or order), was also used for other purposes (which?) and is defined as IN=(year+3)%15. Now Scaliger multiplied the length of the Easter cycle with the indictio, which yields 532*15=7980 years. He also found an epoch, such that every year gives the right SC, GN, or IN remainder when divided by 28, 19, or 15. And this epoch is Jan. 1, 4713 BC (you guessed that already, didn't you?). It's also true, that this is a convenient date for all historical purposes. Example: 1989 has the SC: 10, GN: 14, and IN: 12 (as of the above formulas). 1989+4713 = Julian Year 6702, divided by 28 or 19 or 15 gives the same values for the remainders (without formulas). By the way: The present Julian day is 2,447,747 = Aug. 8, 1989. There is more to say about this, but I don't think it belongs to this group. Thank you for reading this far| Your reward: Here is a piece of a program to compute the date of Easter sunday for any given year (don't know what happens for years BC, not reasonable anyway) which I made some time ago. It is slightly modified from a formula from Carl Friedrich Gauss. ++++++++++++++++++++++++++++++cut here++++++++++++++++++++++++++++++++++++ /* Compute the date of Easter sunday for any year */ /* Based on the formula of Carl Friedrich Gauss */ /* Cornelius Caesar February 22, 1988 */ void easter( year ) int year; { int month, day, a, n, m; if (year < 1583) { n = 6; m = 15; } /* switch to julian calendar */ else { n = year/100-year/400+4; /* switch to Gregorian calendar */ m = n-year/300+11; } a = (((year%19)*19)+m)%30; day = (((year%4)*2+(4*year)+(6*a)+n)%7)+a-9; if (day<1) { month = 3; /* March */ day += 31; } else { month = 4; /* April */ if ((day==26) ((day==25)&&(a==28)&&((11*(m+1)%30)<19))) day -= 7; /* correction: one week earlier */ } printf("Easter sunday is %d/%d/%d\n", month, day, year); } ++++++++++++++++++++++++++++++cut here++++++++++++++++++++++++++++++++++++ This looks somewhat cryptic, but it works and is useful for calendar programs. Gauss took a base date (March 21, 1700) and from this adds the required number of days depending on some other formulas (the above mentioned Sun Circle and Golden Number and "Epakten" and others; it is explained in the reprint of his papers). I just compacted his description for use in a program. INT's need only be 16 bit wide. Hopefully somebody likes it| Cornelius