how to take date exactly older than 30 days in mysql?

If you want to take the date exactly older 30 days in mysql database

If your current date is 4/09/2015

You want the record older than 30 days then the 30th day date is 05/08/2015

mysql> Select * from table_name where current_date() - INTERVAL 30 DAY;

IF YOU GIVE LIKE THIS YOU WILL GET THE EXACTLY THE 30 DAY.


SUPPOSE YOU WANT THE LIST OF ALL THE RECORDS THAT ARE 30 DAYS OLDEER.

FOR THAT

MYSQL> SELECT * FROM table_name where receiveddate < date_sub(now(), INTERVAL 30 DAY)

This will dispaly all the records that are 30 days older.


Hope this post will help someone around the world.

Thank you......


Comments