Add_months function returns a DATETIME value – that adds ‘n‘ number of months from the input date provided.
The syntax of ADD_MONTHS function is: ADD_MONTHS (input_date, n) where:
- input_Date – is the date from which the function is to be applied on.
- n – n is the integer value of number of months to add from the input date
SELECT ADD_MONTHS (SYSDATE, 10) FROM DUAL;
(Sysdate is: 10/29/2018 7:52:53 PM)
Logic: Adds 10 months to the sysdate
Result: 8/29/2019 7:52:53 PM
SELECT ADD_MONTHS (SYSDATE, -10) FROM DUAL;
(Sysdate is: 10/29/2018 7:53:46 PM)
Logic: Adds 10 months to the sysdate
Result: 12/29/2017 7:53:46 PM