HOUR(time)

Returns the hour from a given time (Integer).


timeThe time you want the hour from (Date).

REMARKS
* The "time" can be any string, date or numeric expression.
* If time" is Null, then Null is returned.
* The value returned is between 0 and 23.
* Returns a Variant (Integer) specifying a whole number between 0 and 23, inclusive, representing the hour of the day.
* You can use the MINUTE function to return the minute from a given time.
* You can use the SECOND function to return the seconds from a given time.
* You can use the TIME function to return the current system time.
* The equivalent .NET function is Microsoft.VisualBasic.DateAndTime.Hour
* For the Microsoft documentation refer to docs.microsoft.com

Debug.Print Hour("9:34:20")    '= 9  
Debug.Print Hour("09:34:20") '= 9
Debug.Print Hour("11:15:06") '= 11
Debug.Print Hour("22:00:00") '= 22
Debug.Print Hour("1:1:1") '= 1

Dim tmTime As Variant
tmTime = #6:25:39 AM#
Debug.Print Hour(tmTime) '= 6

tmTime = #6:25:39 PM#
Debug.Print Hour(tmTime) '= 18

© 2021 Better Solutions Limited. All Rights Reserved. © 2021 Better Solutions Limited Top