如何在MySQL中找到两个日期之间的差异?
如何在MySQL中找到两个日期之间的差异?如何在MySQL中找到两个日期之间的差异?,mysql,date,Mysql,Date,如何在MySQL中找到两个日期之间的差异?DATEDIFF返回两个日期之间以天为单位的差异: 学习 mysql> select current_date()>'2011-01-01 12:01:01'; +--------------------------------------+ | current_date()>'2011-01-01 12:01:01' | +--------------------------------------+ |
DATEDIFF
返回两个日期之间以天为单位的差异:
学习
mysql> select current_date()>'2011-01-01 12:01:01';
+--------------------------------------+
| current_date()>'2011-01-01 12:01:01' |
+--------------------------------------+
| 1 |
+--------------------------------------+
1 row in set (0.00 sec)
mysql> select '2011-01-01 12:01:01' > current_date();
+----------------------------------------+
| '2011-01-01 12:01:01' > current_date() |
+----------------------------------------+
| 0 |
+----------------------------------------+
1 row in set (0.00 sec)
mysql>
eg : SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');