timeofday
Elapsed time since midnight for datetimes
Syntax
d = timeofday(t)
Description
d = timeofday(
returns an array of durations equal to the elapsed time since midnight for each of thet
)datetime
values int
. The output argument,d
, is equal to the result oft - dateshift(t,'start','day')
, and is the same size ast
.
If you have
datetime
values with no time zone, thend
also is equal toe = hours(t.Hour) + minutes(t.Minute) + seconds(t.Second)
If a
datetime
value has itsTimeZone
property set to a time zone that does not observe Daylight Saving Time (DST), thend
is equal toe
.If a
datetime
value has itsTimeZone
property set to a time zone that observes DST, thentimeofday
accounts for the DST shift on days when the shift occurs. On those days, for times after the DST shift occurs,d
differs frome
by the amount of the shift.
Examples
Input Arguments
Extended Capabilities
Introduced in R2014b
Was this topic helpful?