Hour - Built-in Date & Time Function¶
Purpose¶
Hour returns the hour from a datetime expression.
Syntax¶
Hour(datetime)
Arguments¶
| Argument | Required | Description |
|---|---|---|
datetime |
Yes | Any valid datetime expression from which the hour will be returned |
Returns¶
Integer
See also¶
- Date
- DateAdd
- DateDiff
- DatePart
- DateValue
- DateSerial
- Day
- InAgedToDays
- InLast4WeeksToSunday
- InLast7Days
- InLastFullMonth
- InLastFullWeek
- InLastYearMTD
- InLastYearYTD
- InLeapYear
- Minute
- Month
- MonthName
- Now
- Second
- Time
- TimeSerial
- TimeValue
- WeekAgo
- Weekday
- WeekdayName
- Year
Example¶
Dim dtSys
Let dtSys = Now()
Return Hour(dtSys) // returns the hour of the current time
Notes¶
- When
datetimecannot be converted to a datetime value, a runtime error is generated. - When
datetimeis passed as a string, your PC's regional settings are used for the conversion to datetime. If that fails, you get a runtime error.