start_of_hour

NAME

start_of_hour(): Returns DATETIME of beginning of round hour of given DATETIME.

TYPE

Function

DESCRIPTION

Returns DATETIME of beginning of round hour of given DATETIME, i.e. seconds and minutes are stripped off the given value.

SYNOPSIS

start_of_hour(dt DATETIME)
  RETURNS DATETIME

Input:

  • dt: a DATETIME object, from which to extract round hour.

EXAMPLES

mysql> SELECT common_schema.start_of_hour('2011-03-24 11:17:08') as dt;
+---------------------+
| dt                  |
+---------------------+
| 2011-03-24 11:00:00 |
+---------------------+

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation