start_of_quarter

NAME

start_of_quarter(): Returns first day of quarter of given datetime, as DATE object.

TYPE

Function

DESCRIPTION

Returns first day of quarter of given DATETIME, as DATE object (equivalent to midnight, first second entering quarter of given DATETIME).

SYNOPSIS

start_of_quarter(dt DATETIME)
  RETURNS DATE

Input:

  • dt: a DATETIME object, from which to extract start of quarter.

EXAMPLES

mysql> SELECT common_schema.start_of_quarter('2011-06-17 18:29:03') as dt;
+------------+
| dt         |
+------------+
| 2011-04-01 |
+------------+

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation