start_of_week

NAME

start_of_week(): Returns first day of week of given DATETIME (i.e. start of Monday), as DATE object

TYPE

Function

DESCRIPTION

Returns midnight, starting Monday in same week as given DATETIME.

SYNOPSIS

start_of_week(dt DATETIME)
  RETURNS DATE

Input:

  • dt: a DATETIME object, from which to extract same week's Monday.

EXAMPLES

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

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation