0

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.

1
  • you want to show all records which are between date1 and date2?
    – blejzz
    Commented Aug 7, 2011 at 12:53

2 Answers 2

4

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'

0
SUBSTRING(now(), 1, 10) = '2015-0-15'
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.