ADD_PERIOD
Use the ADD_PERIOD script function to add a period to a date. The function lets you specify the period as years, months, quarters, or weeks. You can add any number of periods to the date.
Syntax
ADD_PERIOD ([Date Format:]Date, Period Format:Period[, Output Format] )
Parameters
- 
                                                ADD_PERIOD 
 Adds periods to a date
- 
                                                Date Format 
 (Optional) Specifies a format followed by a colon separator (:)
 More Information: Date, Time and Period Formats in Scripts
- 
                                                Date 
 Date to add the period to
 Note: If you do not specify a different format, use YYMMDD or YYYMMDD format.
 Format: script literal or script variable
- 
                                                Period Format:Period 
 Specifies the period format (years, quarters, months, or weeks), and the number of periods to add to the date
 Note: Use : or ; as a separator between the period format and the number of periods.
 More Information:Date, Time and Period Formats in Scripts
- 
                                                Output Format 
 (Optional) Format of the resulting date
 Format: AE name, script literal or script variable
 Default format: YYMMDD
Return Code
The script function returns the resulting date in either the default YYMMDD format, or in the date format that you specify. Keep the output format in mind when you subtract years, quarters and months.
Important! The script results in an error if the calculated date lies after the date 12/31/9999.
Examples
The following example adds two weeks to a date, and prints the result (20.03.2018) in the activation report.
:SET &DATE#=ADD_PERIOD ("DD.MM.YY:06.03.18","WW;2","DD.MM.YYYY")
:PRINT &DATE# 
                                        
The following example adds a quarter to a date, and prints the result (30-04-2018) in the activation report.
:SET &DATE#=ADD_PERIOD ("180131","Q:1","DD-MM-YYYY")
:PRINT &DATE#
                                        
The following example adds a year to a date, and prints the result in the activation report. The script selects the last day of February in the target year, so the result is 28.2.2001 because 2001 is not a leap year.
:SET &DATE#=ADD_PERIOD ("20000229","YY:0001",DD.MM.YYYY)
:PRINT &DATE#
                                        
See also: