Tom Azernour avatar
Written by Tom Azernour
Updated over a week ago

Type: Function

Function: HOUR

Syntax: HOUR([datetime])

Description: This function has two different modes of operation, based on whether an argument is provided or not. With no arguments, it returns the duration of an hour in seconds (3600). With a datetime argument, it returns the hour portion for the provided datetime

Sample usage:

  • HOUR() is equal to 3600

  • HOUR(created_at) returns the hour of the day (between 1 and 24) for the created_at field value.

  • AVG(closed_at-created_at)/HOUR() returns the time elapsed in hours between the creation and closing of a record Note that the difference between two dates (closed_at-created_at) is always returned in seconds.

  • created_at + 12*HOUR() returns the created_at field value plus 12 hours.

Did this answer your question?