HOUR |
HOUR(time) |
Returns the hour from a given time (Integer). |
time | The time you want the hour from (Variant). |
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 NOW function to return the current system date and 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 learn.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("11:15:06 AM") '= 11
Debug.Print Hour("11:15:06 PM") '= 23
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
© 2024 Better Solutions Limited. All Rights Reserved. © 2024 Better Solutions Limited Top