MySQL - 最有效的方式选择今天的日期,时间为00:00:00

时间:2013-03-27 15:50:17

标签: mysql sql select

如何选择当前日期的午夜?

2013-03-27 00:00:00

2 个答案:

答案 0 :(得分:7)

SELECT *
FROM   TableName
WHERE  dateColumn = CURDATE() 

CURDATE()返回当前日期,时间设置为00:00:00

答案 1 :(得分:2)

mysql> select cast(current_date() as datetime);
+----------------------------------+
| cast(current_date() as datetime) |
+----------------------------------+
| 2013-03-27 00:00:00              |
+----------------------------------+
1 row in set (0.00 sec)

mysql>