Built-in Functions → hour
hour() is a scalar date function that returns the hour component of a date/timestamp as an integer.
Signature
hour(field date)
The following table illustrates the *hour() parameter:
Parameter | Description |
---|---|
field date | an expression evaluating to timestamp |
Returns
int
Example
Extract the hour field from December 24, 2001 11:55:12.000.
hour(timestamp("2001-12-24 23:55:12.000"))
This example produces 23.