datetime

Methods

Method Reference: datetime.timeofday

datetime: D = timeofday (T)

Elapsed time since midnight of a datetime array.

D = timeofday (T) returns the elapsed time since midnight for each element of the input datetime array T as a duration array D of the same size as T. For datetime arrays with a time zone, the result accounts for any daylight saving time shift occurring since midnight, so it may differ from the displayed clock time on the day of a transition. Not-A-Time (NaT) values in T are returned as NaN durations.

Source Code: datetime

timeofday returns the elapsed time since midnight as a duration.

 t = datetime (2024, 3, 9, 14, 30, 15)
t =
  datetime

   09-Mar-2024 14:30:15
 timeofday (t)
ans =
  duration

   14:30:15