TIMESTAMPDIFF()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Enterprise Server
Topics on this page:
Overview
Returns arg2 - arg1, where the args are date or datetime expressions. One expression may be a date and the other a datetime, with a date value treated as a datetime having the time part '00:00:00' where necessary.
EXAMPLES
SELECT TIMESTAMPDIFF(MONTH,'2020-02-01','2019-02-01');
+------------------------------------------------+
| TIMESTAMPDIFF(MONTH,'2020-02-01','2019-02-01') |
+------------------------------------------------+
| -12 |
+------------------------------------------------+
SELECT TIMESTAMPDIFF(MONTH,'2019-02-01','2020-02-01');
+------------------------------------------------+
| TIMESTAMPDIFF(MONTH,'2019-02-01','2020-02-01') |
+------------------------------------------------+
| 12 |
+------------------------------------------------+
CHANGE HISTORY
EXTERNAL REFERENCES
Additional information on this topic may be found in the MariaDB Public Knowledge Base.