You are viewing an older version of this section. View current production version.
Join the MemSQL Community Today
Get expert advice, develop skills, and connect with others.

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

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

Related Topics