AddToDate is a PeopleCode built-in function for manipulating a date in PeopleCode.
You can use it to adjust dates forwards and backwards, by a given number of years, months or days.
The basic syntax is:
Local date &dtExample;&dtExample = %Date;/* Get date forward 1 year, 0 months, 0 days */&dtExample = AddToDate(&dtExample, 1, 0, 0);/* Get date forward 0 years, 0 months, 30 days */&dtExample = AddToDate(&dtExample, 0, 0, 30);/* Get date backward 0 years, 3 months, 0 days */&dtExample = AddToDate(&dtExample, 0, - 3, 0);/* Get date backward 0 years, 0 months, 14 days */&dtExample = AddToDate(&dtExample, 0, 0, - 14);
There are are also two related functions:
- AddToTime which adds, hours, minutes, and seconds to a time
- AddToDateTime which works on both dates and times. This caters for 6 parameters: years, months, days, hours, minutes, and seconds.