start_of_year

NAME

start_of_year(): Returns first day of year of given DATETIME, as DATE object.

TYPE

Function

DESCRIPTION

Returns starting midnight of January 1st, in same year as in given DATETIME.

SYNOPSIS

start_of_year(dt DATETIME)
  RETURNS DATE 

Input:

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

EXAMPLES

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

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation