Reputation: 69
In mysql date is formated as yyyy-mm-dd. I would to retrieve all related posts that is more then 25 days old.
Something like this:
SELECT * FROM post WHERE writtenday >= 25;
Many thanks
Upvotes: 0
Views: 67
Reputation: 11265
SELECT * FROM post WHERE DATEDIFF(CURDATE(), writtenday) >= 25;
Upvotes: 1
Reputation: 50560
You can use the DATE_SUB function
DATE_SUB
WHERE writtenday <= DATE_SUB(NOW(), INTERVAL 25 DAY)
This will retrieve anything that is older than TODAY-25 Days