如何找到MySQL中两个日期之间的区别?

时间:2011-04-15 10:57:10

标签: mysql date

如何在MySQL中找到两个日期之间的差异?

3 个答案:

答案 0 :(得分:2)

答案 1 :(得分:0)

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> 

答案 2 :(得分:0)

了解DATEDIFF

eg :     SELECT DATEDIFF('2007-12-31 23:59:59','2007-12-30');