The function DateTimeToModifiedJulianDate converts a TDateTime value into its corresponding modified Julian date.

Julian dates are commonly used by astronomers, geophysicists, and others, and used in computer science to calculate the difference between days, since all numbers in the system are consecutive integers. A Julian date (or Julian Day) is a number that refers to the number of days, including fractional days, that have elapsed since a particular historical point in time. The current Julian cycle started at Greenwich noon on January 1, 4713 B.C. (Gregorian calendar), and will end on January 22, 3268 A.D. For example, the Julian date for December 11, 1942 is 2430705; while December 12, 1942 is 2430706.

The modified Julian date is the number of days, including fractional days, since Greenwich midnight on November 17, 1858. Modified Julian dates are based on Julian dates, but adjusted to use midnight rather than noon as a starting point, and to use a more recent date as a starting point.

Declaration: function DateTimeToModifiedJulianDate(const AValue: TDateTime): Double;

Here is an easy example.

procedure OnMapEvent(var Value:Variant);
var
TheDate : TDateTime;
TheJDate : double;
begin
//Returns '06-12-2023 00:00:00.000 trasnslates to 60284'
TheDate := Date;
TheJDate := DateTimeToModifiedJulianDate(TheDate);
LogInfo(FormatDateTime('dd-mm-yyyy hh:nn:ss.zzz', TheDate)+' trasnslates to '+FloatToStr(TheJDate));
 
 
//Returns '06-12-2023 11:08:04.965 trasnslates to 60284.4639463541'
TheDate := Now;
TheJDate := DateTimeToModifiedJulianDate(TheDate);
LogInfo(FormatDateTime('dd-mm-yyyy hh:nn:ss.zzz', TheDate)+' trasnslates to '+FloatToStr(TheJDate));
 
end;