Returns an Integer value from 0 through 23 representing the hour of the day.
Public Function Hour(ByVal TimeValue As DateTime) As Integer
You can also obtain the hour of the day by calling DatePart and specifying DateInterval.Hour for the Interval argument.
This example uses the Hour function to obtain the hour from a specified time. In the development environment, the time literal is displayed in short time format using the locale settings of your code.
Dim MyTime As Date Dim MyHour As Integer MyTime = #4:35:17 PM# ' Assign a time. MyHour =Hour(MyTime)' MyHour contains 16.
Namespace: Microsoft.VisualBasic
Module: DateAndTime
Assembly: Microsoft Visual Basic .NET Runtime (in Microsoft.VisualBasic.dll)
Day Function | Minute Function | Now Property | Second Function | TimeOfDay Property | DatePart Function |