Caché Basic Reference
[Home] [Back] [Next]
InterSystems: The power behind what matters   
Class Reference   

Returns a whole number between 0 and 23, inclusive, representing the hour of the day.
The time argument is any expression that can represent a time. This includes a time value such as “12:30” or “1:27:55”, a time/date value such as “11/12/1999 12:33:00”, or a date value such as “11/12/1999”. If only a date is specified, the time defaults to 00:00:00. Fractional seconds are permitted, but ignored; they are truncated, not rounded.
The following example uses the Hour function to obtain the hour from the current time:
Dim MyTime, MyHour
MyTime = Now
MyHour = Hour(MyTime) ' MyHour contains the number representing 
                      ' the current hour.
Println MyHour
The following example returns an hour value of 13:
Dim MyHour
MyHour = Hour("13:59:59.999")
Println MyHour
See Also