TO_HOUR (Lakehouse v1)
Converts a date with time (timestamp/datetime) to a UInt8 number containing the number of the hour in 24-hour time (0-23). This function assumes that if clocks are moved ahead, it is by one hour and occurs at 2 a.m., and if clocks are moved back, it is by one hour and occurs at 3 a.m. (which is not always true – even in Moscow the clocks were twice changed at a different time).
Analyze Syntax
Section titled “Analyze Syntax”func.to_hour(<expr>)Analyze Examples
Section titled “Analyze Examples”func.to_hour('2023-11-12 09:38:18.165575')
┌────────────────────────────────────────────────────┐│ func.to_hour('2023-11-12 09:38:18.165575') ││ UInt8 │├────────────────────────────────────────────────────┤│ 9 │└────────────────────────────────────────────────────┘SQL Syntax
Section titled “SQL Syntax”TO_HOUR(<expr>)Arguments
Section titled “Arguments”| Arguments | Description |
|---|---|
<expr> | timestamp |
Return Type
Section titled “Return Type”TINYINT
SQL Examples
Section titled “SQL Examples”SELECT to_hour('2023-11-12 09:38:18.165575')
┌───────────────────────────────────────┐│ to_hour('2023-11-12 09:38:18.165575') ││ UInt8 │├───────────────────────────────────────┤│ 9 │└───────────────────────────────────────┘