Skip to main content

TO_START_OF_WEEK

Returns the first day of the year for a date or a date with time.

Syntax

to_start_of_week(expr)

Arguments

ArgumentsDescription
exprdate/datetime

Return Type

Datetime object, returns date in “YYYY-MM-DD” format.

Examples

SELECT to_start_of_week(now());
+----------------------+
| to_start_of_week(now()) |
+----------------------+
| 2022-03-27 |
+----------------------+

SELECT to_start_of_week(to_datetime(1630812366));
+---------------------------------------+
| to_start_of_week(to_datetime(1630812366)) |
+---------------------------------------+
| 2021-09-05 |
+---------------------------------------+