start_of_month

NAME

start_of_month(): Returns first day of month of given DATETIME, as DATE object.

TYPE

Function

DESCRIPTION

Returns first day of month of given DATETIME, as DATE object (equivalent to midnight, the first second of given DATETIME's month).

SYNOPSIS

start_of_month(dt DATETIME)
  RETURNS DATE

Input:

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

EXAMPLES

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

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation