Return list of date using a set value
问题 How can I subtract a number of months from a date, to produce a different date? var date_A = 24-06-2016 var date_B = 24-01-2016 var x = 5 Please how can I use the value in x (number of months) to calculate the value for date_B, from the value date_A? 回答1: You can use the add_months() function: select add_months(to_date('24-06-2016', 'DD-MM-YYYY'), -5) from dual; ADD_MONTHS(TO_DATE('24-06-2016','DD-MM-YYYY'),-6) ------------------------------------------------- 2015-12-24 With SQL*Plus or SQL