I have the date in 开发者_Go百科this format in mySQL databse:
2011-02-21 14:40:03
But i have to compare only datepart of this dateandtime i.e:
2011-02-21
How???
A better solution is to use WHERE col >= '2011-02-21' AND col < '2011-02-22'
, so MySql can use a index if there is one present.
... where date(datetime_column) = '2011-02-21'
Here is the documentation
精彩评论