Reputation: 1543
I am executing this query
SELECT *
FROM temp
WHERE DATE_FORMAT(startTime,'%m/%d/%Y') = '7/15/2012'
and startTime
column has this value '2012-07-15 12:00:00'
But this is not returning any results. Can somebody please help?
Upvotes: 0
Views: 75
Reputation: 183251
According to the documentation for the DATE_FORMAT
function, %m
is "Month, numeric (00
..12
)". Note the zero-padding. So you need to write '07/15/2012'
rather than '7/15/2012'
.
(And in case you're wondering — I have no idea what month #0 is. So far as I'm aware, the months range from 01
to 12
. Maybe some locales do have a month #0?)
Upvotes: 1