start_of_week_sunday

NAME

start_of_week_sunday(): Returns first day of week, Sunday based, of given datetime, as DATE object

TYPE

Function

DESCRIPTION

Returns midnight, starting Sunday in same week as given DATETIME. Some calendars (i.e. Jewish/Israeli calendar) begin the working week on Sunday.

SYNOPSIS

start_of_week_sunday(dt DATETIME)
  RETURNS DATE

Input:

  • dt: a DATETIME object, from which to extract same week's Sunday (the Sunday just before or at the given DATETIME).

EXAMPLES

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

ENVIRONMENT

MySQL 5.1 or newer

AUTHOR

Shlomi Noach
 
common_schema documentation