DATEDIFF(expr1,expr2) : DATEDIFF : Date Time Functions MySQL TUTORIALS


MySQL TUTORIALS » Date Time Functions » DATEDIFF »

 

DATEDIFF(expr1,expr2)


Only the date parts of the values are used in the calculation.

mysql>
mysql> SELECT DATEDIFF('1997-12-31 23:59:59','1997-12-30');
+----------------------------------------------+
| DATEDIFF('1997-12-31 23:59:59','1997-12-30') |
+----------------------------------------------+
|                                            |
+----------------------------------------------+
row in set (0.00 sec)

mysql>
mysql> SELECT DATEDIFF('1997-11-30 23:59:59','1997-12-31');
+----------------------------------------------+
| DATEDIFF('1997-11-30 23:59:59','1997-12-31') |
+----------------------------------------------+
|                                          -31 |
+----------------------------------------------+
row in set (0.00 sec)

mysql>



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

MySQL TUTORIALS

 Navioo Date Time Functions
» DATEDIFF