David19801
David19801

Reputation: 11448

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 proper way to do it with mysql and php?

Upvotes: 1

Views: 188

Answers (1)

Marc B
Marc B

Reputation: 360842

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

Upvotes: 1

Related Questions