seconds_sub

description

Syntax

DATETIME SECONDS_SUB(DATETIME date, INT seconds)

Subtracts a specified number of seconds from a datetime or date

The parameter date can be DATETIME or DATE, and the return type is DATETIME.

example

  1. mysql> select seconds_sub("2020-01-01 00:00:00", 1);
  2. +---------------------------------------+
  3. | seconds_sub('2020-01-01 00:00:00', 1) |
  4. +---------------------------------------+
  5. | 2019-12-31 23:59:59 |
  6. +---------------------------------------+

keywords

  1. SECONDS_SUB