Important
The SingleStore 9.1 release candidate (RC) is available now. It will be promoted to general availability (GA) soon and at that time it will be renamed to SingleStore 10.
In the interim, SingleStore 9.1 RC can be used to preview, evaluate, and provide feedback on the new and upcoming features in SingleStore 10, while SingleStore 9.0 is recommended for production workloads.
TIMESTAMPDIFF
On this page
The TIMESTAMPDIFF() function finds the difference between two date or datetime objects in the specified unit.
Syntax
TIMESTAMPDIFF ({YEAR | QUARTER | MONTH | WEEK | DAY | HOUR | MINUTE | SECOND | MICROSECOND}, date1, date2)Arguments
-
date1, date2: a valid date, datetime, or parsable date string
Return Type
Integer.
Examples
SELECT TIMESTAMPDIFF(QUARTER, '2009-02-13', '2013-09-01');
+----------------------------------------------------+
| TIMESTAMPDIFF(QUARTER, '2009-02-13', '2013-09-01') |
+----------------------------------------------------+
| 18 |
+----------------------------------------------------+SELECT TIMESTAMPDIFF(SECOND, '2009-02-14 01:17:01', '2009-02-13 23:31:30');
+---------------------------------------------------------------------+
| TIMESTAMPDIFF(SECOND, '2009-02-14 01:17:01', '2009-02-13 23:31:30') |
+---------------------------------------------------------------------+
| -6331 |
+---------------------------------------------------------------------+Related Topics
Last modified: