datetime

Methods

Method Reference: datetime.datenum

datetime: N = datenum (T)

Convert datetime array to serial date numbers.

N = datenum (T) returns a double array N of the same size as T holding the serial date number of each element, where 1 corresponds to January 1 of the year 0000 and the fractional part represents the time of day. The time zone of a zoned T is ignored; its wall-clock components are used. Not-A-Time (NaT) values are returned as NaN, and infinite datetimes preserve their sign.

A serial date number has no room for an inserted leap second, so for a 'UTCLeapSeconds' array the 60th second of a minute folds backward onto the 59th: datenum of 2016-12-31T23:59:60Z equals that of 2016-12-31T23:59:59Z.

Source Code: datetime

datenum returns the serial date number — days since the start of the year 0 — with the time of day in the fractional part.

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

   09-Mar-2024 06:00:00
 datenum (t)
ans = 7.3932e+05