-6

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

2013-03-27 00:00:00

4

2 回答 2

7
SELECT *
FROM   TableName
WHERE  dateColumn = CURDATE() 

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

于 2013-03-27T15:51:22.220 回答
4
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> 
于 2013-03-27T16:01:53.050 回答