VeloDB Cloud
SQL Manual
Functions
date-time-functions
days_sub

days_sub

Description

Syntax:

DATETIME DAYS_SUB(DATETIME date, INT days)

This function subtracts the specified days from the DATE or DATETIME.

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

Example

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

Keywords

DAYS_SUB