VeloDB Cloud
SQL Manual
Functions
date-time-functions
weeks_sub

weeks_sub

Description

Syntax:

DATETIME WEEKS_SUB(DATETIME date, INT weeks)

This function subtracts the specified weeks from the given date.

date can be of DATE or DATETIME type, and the returned result is of the same type as date.

Example

mysql> select weeks_sub("2020-02-02 02:02:02", 1);
+-------------------------------------+
| weeks_sub('2020-02-02 02:02:02', 1) |
+-------------------------------------+
| 2020-01-26 02:02:02                 |
+-------------------------------------+

Keywords

WEEKS_SUB