Re: Julian Day Calculation - Plea for Help
- To: mathgroup at smc.vnet.net
- Subject: [mg3924] Re: Julian Day Calculation - Plea for Help
- From: Mark Radomski <Mark.Radomski at gsfc.nasa.gov>
- Date: Fri, 10 May 1996 03:28:41 -0400
- Organization: NASA Goddard Space Flight Center -- Greenbelt, Maryland USA
- Sender: owner-wri-mathgroup at wolfram.com
Matthew K. wrote: > > ...snip... > I need , if possible, to get the equation for calculating the Julian Day > well into the future (we're talking 1000 years here). > > If anyone can help me, it would be most appreciated. Please e-mail if you > would at searchme at earthlink.net as I seldom check this group, not being a > professional in this field. And if it is not something that can be easily > calculated (requires an algorithm or something along those lines), could > someone please let me know that?? Thanks so much for any assistance. > > Lisa > -- > emergency address only: SMS CDs @aol.com The following lines of code (Basic, in this example) calculate the Julian date according to the algorithm of Fliegel and Van Flandern (Henry F. Fliegel and Thomas C. Van Flandern, "A Machine Algorithm for Processing Calendar Dates," Comm. ACM, Vol. 11, p.657, 1968): 100 INPUT "YR-1900,MO,DAY"; I, J, K 500 LL = -INT((14 - J) / 12): II = I + 1900 550 DJUL = K - 32075 + INT(1461 * (II + 4800 + LL) / 4) + INT(367 * (J - 2 - LL * 12) / 12) - INT(3 * INT((II + 4900 + LL) / 100) / 4) The INT function (which truncates toward 0 to integer) can be left out if you're coding in FORTRAN (or C for years >0 A.D.) which automatically truncates integer division. Suprisingly easy, wasn't it? This will be good for as far into the future as we keep our current scheme of assigning leap years/days (political and therefore unpredictable). Mark Radomski Computer Sciences Corporation P.S. Please excuse any formatting/routing problems. I'm experimenting with a new (to me) newsreader and server. ==== [MESSAGE SEPARATOR] ====