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
精彩评论