timeofday
Elapsed time since midnight for datetime arrays
Description
T = timeofday(DT)datetime array.
                The function returns the clock times as a duration array whose
                values equal the elapsed time since midnight for each element in the
                    datetime array.
For datetime arrays without time zones, and in most other
                cases, the elapsed time since midnight, E, is equal
                to
E = hours(DT.Hour) + minutes(DT.Minute) + seconds(DT.Second)
If DT has its TimeZone property set to a
                time zone that respects Daylight Saving Time (DST), then
                    timeofday takes DST into account. For more information, see
                    Algorithms.
The output argument T is also equivalent to DT -
                    dateshift(DT,'start','day').
Examples
Input Arguments
Output Arguments
Algorithms
A datetime array can have its TimeZone property
            set to a time zone that observes Daylight Saving Time (DST). The
                timeofday function takes DST into account.
- If the input argument - DTis a- datetimearray with no time zone, then the output- Tis also equal to- E = hours(DT.Hour) + minutes(DT.Minute) + seconds(DT.Second) 
- If - DThas its- TimeZoneproperty set to a time zone that does not observe DST, then- Tis equal to- E.
- If - DThas its- TimeZoneproperty set to a time zone that observes DST, then- timeofdayaccounts for the DST shift on days when the shift occurs. On those days, for times after the DST shift occurs,- Tdiffers from- Eby the amount of the shift.
Extended Capabilities
Version History
Introduced in R2014b