If you need to select records from MySQL table records with date today and last 30 days records. based on the Server date.

Posted: October 25, 2013 in All Category

SELECT * FROM posts WHERE 
date_of_create BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE();

SELECT DATE_FORMAT(date_of_create, '%m/%d/%Y') FROM posts
WHERE   date_of_create BETWEEN CURDATE() - INTERVAL 30 DAY AND CURDATE()
Advertisements

Comments are closed.