hour() function

Extract the hour from a datetime or time, or the number of hours from a Interval

Syntax

hour(datetime)
hour(Interval)

Arguments

date - is datetime or time. The date to extract the hour from.
Interval - is Interval. The Interval to return the number of hours from.

Example

hour('2012-07-22T13:24:57') → 13
hour(tointerval('3 hours')) → 3
hour(age('2012-07-22T13:00:00','2012-07-22T10:00:00')) → 3
hour(age('2012-01-01','2010-01-01')) → 17520