hours_sub
hours_subβ
descriptionβ
Syntaxβ
DATETIME HOURS_SUB(DATETIME date, INT hours)
Subtracts a specified number of hours from a datetime or date
The parameter date can be DATETIME or DATE, and the return type is DATETIME.
exampleβ
mysql> select hours_sub("2020-02-02 02:02:02", 1);
+-------------------------------------+
| hours_sub('2020-02-02 02:02:02', 1) |
+-------------------------------------+
| 2020-02-02 01:02:02 |
+-------------------------------------+
keywordsβ
HOURS_SUB