The VBA Hour Function returns the hour component of a supplied time. The syntax of the function is:
A simple example of the VBA Hour function is shown below:
' Extract the hour component from the time "17:56:33"
Const currTime = "17:56:33"hourNum = Hour(currTime)
Dim hourNum As Integer
After running the above snippet of VBA code, the variable hourNum holds the value 17, which is the hour component of the supplied time "17:56:33".