ModifiedJulianDateToDateTime
A Julian date is 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.
However, a 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.
The function ModifiedJulianDateToDateTime converts a modified Julian Date into its corresponding TDateTime value.
Where the specified Julian Date AValue cannot be converted, ModifiedJulianDateToDateTime raises an exception error.
Declaration: function ModifiedJulianDateToDateTime(const AValue: Double): TDateTime;
Here is an easy example.
procedure
OnMapEvent(
var
Value:Variant);
var
TheDate : TDateTime;
TheJDate :
double
;
begin
//Returns 'The Julian 60054.56789 is 20-04-2023 13:37:45.696'
TheJDate :=
60054.56789
;
TheDate := ModifiedJulianDateToDateTime(TheJDate);
LogInfo(
'The Julian '
+FloatToStr(TheJDate)+
' is '
+FormatDateTime(
'dd-mm-yyyy hh:nn:ss.zzz'
, TheDate));
//Returns 'The Julian 60283.64920267 is 05-12-2023 15:34:51.111'
TheJDate :=
60283.64920267
;
TheDate := ModifiedJulianDateToDateTime(TheJDate);
LogInfo(
'The Julian '
+FloatToStr(TheJDate)+
' is '
+FormatDateTime(
'dd-mm-yyyy hh:nn:ss.zzz'
, TheDate));
//Returns 'The Julian 48800.5 is 27-06-1992 12:00:00.000'
TheJDate :=
48800.5
;
TheDate := ModifiedJulianDateToDateTime(TheJDate);
LogInfo(
'The Julian '
+FloatToStr(TheJDate)+
' is '
+FormatDateTime(
'dd-mm-yyyy hh:nn:ss.zzz'
, TheDate));
end
;