Home > OS >  How do I add one year to this MySQL query?
How do I add one year to this MySQL query?

Time:12-27

    SELECT date_format(CURDATE(), '%e-%b-%y');

This spits out the date to be 27-Dec-22 and I simply need to run another query so it shows 27-Dec-23

CodePudding user response:

You may directly add one year using INTERVAL syntax:

SELECT DATE_FORMAT(CURDATE()   INTERVAL 1 year, '%e-%b-%y');  -- 27-Dec-23

CodePudding user response:

You can use INTERVAL in this case

SELECT date_format(CURDATE()  INTERVAL 1 YEAR, '%e-%b-%y')

CodePudding user response:

DATE_FORMAT(DATE_ADD(your date INTERVAL 1 YEAR), '%e-%b-%y')

  • Related