HOUR
Syntax
%%{init: {
'theme': 'base',
'flowchart': { 'padding': '7', 'nodeSpacing': '20', 'rankSpacing': '20' },
'themeVariables': {
'fontSize': '11px',
'fontFamily': 'Arial'
}
}}%%
flowchart LR
Start((START)) --> HOUR[HOUR]:::quoted
HOUR --> End((END))
Purpose
The HOUR SQL function extract the hour from a date/time.
See also DAY, MICROSECOND, MILLISECOND, MINUTE, MONTH, SECOND and YEAR.
Parameters:
- Input (
datetime): the date/time to extract the hours from.
Returns: the hour as an int32.
Examples
The following example extracts the hours from current system date/time in UTC:
select hour(sysdateutc)
-------------------
13
The following example extracts the hours from noon January 1, 2026:
select hour(to_date('20260101120000', 'YYYYMMDDHH24MISS'))
-------------------
12