How to get the rows out of a MySQL DB where the field date is before NOW + 2 weeks?
I have tried
WHERE date_ready < DATE_SUB(CURDATE(), INTERVAL 2 WEEK)
But that is not the rows returning that I expect.
Or even, now()
minus 2 week,
where date_ready < (NOW() - INTERVAL 2 WEEK)
with just date
where date_ready < (CURDATE() - INTERVAL 2 WEEK)
You're querying dates that are before today minus two weeks, not plus. You should use date_add
instead of date_sub
:
WHERE date_ready < DATE_ADD(CURDATE(), INTERVAL 2 WEEK)
-- Here -----------^
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With