Documentation
Hour number
h = hour(t)
example
h = hour(t)returns the hour numbers of the datetime values int. Thehoutput is adoublearray the same size astand contains integer values from 0 to 23.
t
h
double
Thehourfunction returns the hour numbers of datetime values. To assign hour values to a datetime array,t, uset.Hourand modify theHourproperty.
hour
t.Hour
Hour
collapse all
t = datetime('today'):hours(8):datetime('tomorrow'); t.Format ='MMM dd, HH:mm'
t =1x4 datetime arrayFeb 01, 00:00 Feb 01, 08:00 Feb 01, 16:00 Feb 02, 00:00
h =1×40 8 16 0
datetime
Input date and time, specified as adatetimearray.
This function fully supports tall arrays. For more information, seeTall Arrays.
This function fully supports distributed arrays. For more information, seeRun MATLAB Functions with Distributed Arrays(Parallel Computing Toolbox).
hms|minute|second|timeofday
hms
minute
second
timeofday
A modified version of this example exists on your system. Do you want to open this version instead?
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select:.
You can also select a web site from the following list:
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Contact your local office
Get trial now