In DateTime§
See primary documentation in context for method modified-julian-date.
method modified-julian-date(DateTime:D: --> Real:D)
Returns the Modified Julian Date (MJD) for the UTC date and time.
say DateTime.new('2021-12-24T12:23:00.43Z').modified-julian-date; # OUTPUT: «59572.5159772»
Notice the fractional part of the modified-julian-date is same value as the day-fraction for the same instant, and is similarly affected by leap seconds. Likewise, the integral part of the MJD is the same value as the daycount for the same instant since they reference the same epoch (November 17, 1858). The MJD is obtained by subtracting the constant 2_400_000.5 from the Julian Date and is used to simplify transformations between civil and astronomical time systems.
Before Rakudo release 2025.08, the modified-julian-date method does not use any timezone information, and silently ignores it in the DateTime object.
Available as of the 2021.04 Rakudo compiler release.