Watch the 7.3 Webinar On-Demand
This new release brings updates to Universal Storage, query optimization, and usability that you won’t want to miss.

HOUR

Extracts the hour of the day from the given datetime, zero-indexed. Midnight is 0, 11PM is 23.

Syntax

HOUR ( dateobj )

Arguments

  • dateobj: a valid date, datetime, time, or parsable datetime string.

Return Type

Integer

Examples

select hour('2009-02-13 23:31:30');
+-----------------------------+
| hour('2009-02-13 23:31:30') |
+-----------------------------+
|                          23 |
+-----------------------------+

Related Topics