Reputation:
I have a field in a table called created_at which i would to compare with two different dates.
e.g. created_at BETWEEN '2011-08-01 13:23:21' AND '2011-08-07 13:23:21'
i like to show all records which created in these two dates.
i have tried different method but still with no luck.
Upvotes: 0
Views: 3522
Reputation: 1744
First be sure to set your date_field to DATETIME type, then do the query like this:
SELECT * FROM your_table WHERE date_field >= '2011-08-01 13:23:21' AND date_field <= '2011-08-07 13:23:21'
Upvotes: 4