datetime

Methods

Method Reference: datetime.juliandate

datetime: J = juliandate (T)
datetime: J = juliandate (T, dateType)

Convert datetime array to Julian dates.

J = juliandate (T) returns a double array J of the same size as T holding the Julian date of each element, that is, the number of days (including a fractional part) since noon UTC on January 1, 4713 BCE. Unlike datenum, the result is based on the absolute UTC instant, so the time zone of a zoned T is taken into account; datetime arrays without a time zone are treated as UTC. Not-A-Time (NaT) values are returned as NaN.

J = juliandate (T, dateType) selects the kind of Julian date: 'juliandate' (default) or 'modifiedjuliandate', the latter being the Julian date minus 2400000.5.

For a 'UTCLeapSeconds' array a Julian day that holds an inserted second is 86401 seconds long, and the fractional part is that fraction of the day’s true length. Julian days run from noon to noon and modified Julian days from midnight to midnight, so on such a day the two are stretched over different spans and are not related by exactly 2400000.5; both are 'juliandate' for the day at hand.

Source Code: datetime

juliandate returns the Julian date — days since noon UTC on 1 January 4713 BCE. Unlike datenum, it is based on the absolute UTC instant. Pass 'modifiedjuliandate' for the modified form.

 t = datetime (2024, 3, 9, 6, 0, 0)
t =
  datetime

   09-Mar-2024 06:00:00
 juliandate (t)
ans = 2.4604e+06
 juliandate (t, 'modifiedjuliandate')
ans = 6.0378e+04