Access: Hour Function
In Access, the Hour function returns the hour of the day (a number from 0 to 23) given a time value.
The syntax for the Hour function is:
Hour ( time_value )
time_value is a valid time.
For example:
Hour (#10:42:58 PM#) would return 22 Hour (#10:42:58 AM#) would return 10 Hour (#22/11/2003 10:42:58 PM#) would return 22
VBA Code
The Hour function can be used in VBA code. For example:
Dim LHour As Integer
LHour = Hour(#10:42:58 PM#)
In this example, the variable called LHour would now contain the value of 22.
SQL/Queries
You can also use the Hour function in a query.
