开发者

mysql date and datetime problem

I have a mysql table called table1. with id and dt columns. The dt is of type datetime.

From this, I am trying to extract all id's with a specific date (not given the time, just the date, like 2011-02-11 say)

I could do it as a between the 00:00:00 and midnight of that date, but is their a pr开发者_运维百科oper way to do it with mysql and php?


SELECT id, dt 
FROM table1
WHERE DATE(dt) = '2011-02-11'

MySQL's got a pretty comprehensive set of Date/Time handling functions, documented here

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜