JulianDate

delphimoon

Julian Date

Algorithms

Top  Previous  Next

 

Converts a Delphi TDatetime to the julian date and back.

 

function Julian_Date(date: TDateTime): extended;

function Delphi_Date(date: extended): TDateTime;

 

Description

The julian date (JD) is a representation for dates often used in astronomy. It is defined as being the number of days elapsed since noon January 1st, 4712 b.c. It has the advantage of being much easier to use in calculations than day, months etc., in fact the Delphi TDateTime is nothing but a julian date with a different date used for the 0 (since Delphi 2 it is December 30th 1899).

 

There is another very similar definition of the julian date, called the modified julian date (MJD). It is defined as

 

         MJD = JD - 2400 000.5

 

Hint

Note that Delphi TDateTime should be a julian date variant, however is implemented with several bugs; there are some corrected functions provided to replace the Delphi ones, or the more flexible direct calendar algorithms

 

Note

Starting with Delphi 6 the VCL contains the functions JulianDateToDateTime and DateTimeToJulianDate which does the same as these ones.

 

Reference

These functions are based upon chapter 7 of "Astronomical Algorithms".