One of my new Project, I need to Display Latest Updates of last 3 days. With MySQL’s date_add we can achieve result, see the below example.
WHERE post_date >= DATE_ADD(CURDATE(), INTERVAL -3 DAY); //SELECT * FROM posts a where post_created >= DATE_ADD(CURDATE(), INTERVAL -3 DAY);
Note that I’m using a negative date value. You can use a positive date value to get tomorrow, next week, next month, etc..
I hope you like this Post, Please feel free to comment below, your suggestion and problems if you face - we are here to solve your problems.