In article <[EMAIL PROTECTED]>, _brian_d_foy <[EMAIL PROTECTED]> wrote:
* Dave Cross sent me a much better patch, so this is the revised patch. (I think he sent it here too, but it hasn't shown up) Index: perlfaq4.pod =================================================================== RCS file: /cvs/public/perlfaq/perlfaq4.pod,v retrieving revision 1.59 diff -u -d -r1.59 perlfaq4.pod --- perlfaq4.pod 19 Jan 2005 16:09:31 -0000 1.59 +++ perlfaq4.pod 31 Jan 2005 17:15:44 -0000 @@ -454,26 +454,29 @@ =head2 How can I find the Julian Day? -Use the Time::JulianDay module (part of the Time-modules bundle -available from CPAN.) +(contributed by brian d foy and Dave Cross) -Before you immerse yourself too deeply in this, be sure to verify that -it is the I<Julian> Day you really want. Are you interested in a way -of getting serial days so that you just can tell how many days they -are apart or so that you can do also other date arithmetic? If you -are interested in performing date arithmetic, this can be done using -modules Date::Manip or Date::Calc. +You can use the Time::JulianDay module available on CPAN. Ensure that +you really want to find a Julian day, though, as many people have +different ideas about Julian days. See +http://www.hermetic.ch/cal_stud/jdn.htm for instance. -There is too many details and much confusion on this issue to cover in -this FAQ, but the term is applied (correctly) to a calendar now -supplanted by the Gregorian Calendar, with the Julian Calendar failing -to adjust properly for leap years on centennial years (among other -annoyances). The term is also used (incorrectly) to mean: [1] days in -the Gregorian Calendar; and [2] days since a particular starting time -or `epoch', usually 1970 in the Unix world and 1980 in the -MS-DOS/Windows world. If you find that it is not the first meaning -that you really want, then check out the Date::Manip and Date::Calc -modules. (Thanks to David Cassell for most of this text.) +You can also try the DateTime module, which can convert a date/time +to a Julian Day. + + $ perl -MDateTime -le'print DateTime->today->jd' + 2453401.5 + +Or the modified Julian Day + + $ perl -MDateTime -le'print DateTime->today->mjd' + 53401 + +Or even the day of the year (which is what some people think of as a +Julian day) + + $ perl -MDateTime -le'print DateTime->today->doy' + 31 =head2 How do I find yesterday's date? -- brian d foy, [EMAIL PROTECTED]