add months to date in peoplecode
add months to date in peoplecode using function is AddToDate of PeopleSoft. This function to add the specified number of years, months, and days to the date provided.
Syntax: AddToDate(date, num_years, num_months, num_days)
1 2 3 4 5 6 7 8 |
Local date &result_dt,&current_dt; &current_dt= %Date; /* Get date forward 2 year, 0 months, 3 days */ &result_dt= AddToDate(&current_dt, 2, 0, 3); /* Get date forward 0 years, 1 months, 30 days */ &result_dt= AddToDate(&current_dt, 0, 1, 30); |
Example add date forward 2 year, 6 months.
1 2 |
¤t_dt='03/09/2018'; &result_dt = AddToDate(¤t_dt,2,6,0); |
&result_dt = 03/03/2021
References:
http://peoplesoft.wikidot.com/addtodate
https://docs.oracle.com/cd/E13292_01/pt849pbr0/eng/psbooks/tpcl/book.htm?File=tpcl/htm/tpcl02.htm#H2001