Online Tutorials & Training Materials | STechies.com
Register Login

How to add Months to the Date.

|| 1

How to add Months to the Date.
Stechies

Is there a function to add the months to a date, for eg: 24-02-99 + 6 months = 24-08-99.



The date is normally in the format 19990224 and you can then use
variable+4(2) = variable+4(2) + 6.

Otherwise you can use the function RP_CALC_DATE_IN_INTERVAL.

call function 'RP_CALC_DATE_IN_INTERVAL'
exporting
date = datum "variable with you date before adding 6 month
days = nul "variable with the value of 0
months = halfyear "Variable with the value 6
* SIGNUM = '+'
years = nul

importing
calc_date = datum "the variable will now hold your new date
exceptions
others = 1.


Comments

  • 06 May 2010 8:43 am
    Good one