Outdated Version

You are viewing an older version of this section. View current production version.

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