DATEDIFF()
This page is part of MariaDB's Documentation.
The parent of this page is: Functions for MariaDB Xpand
Topics on this page:
Overview
Calculates the differences in days between two DATE arguments.
USAGE
DATEDIFF(timestamp, timestamp)
Argument Name | Description |
|---|---|
| Two moments in time to compare |
DETAILS
DATEDIFF() is a date-time function that returns the difference in days between two date arguments.
The second argument is subtracted from the first argument.
A NULL is returned if any argument is NULL.
EXAMPLES
SELECT DATEDIFF('2020-03-01 23:59:59', '2020-02-01');
+-----------------------------------------------+
| DATEDIFF('2020-03-01 23:59:59', '2020-02-01') |
+-----------------------------------------------+
| 29 |
+-----------------------------------------------+
