Script Function: Adds a period to a specified date.
ADD_PERIOD(Date, Period Format:Period, [Output Format])
Syntax |
Description/Format |
---|---|
Date |
Indication of a date in the format "YYMMDD" or "YYYYMMDD". Format: script literal or script variable It is also possible to specify a different date format. Do so by entering the required date format, then enter a separator (: or ;) and afterwards the date. Indicating a date format is optional. |
Period Format:Period |
Format: script literal or script variable Period: Entry of a period to be added to specified date. As a separator between the Period Format and the Period you can either use a colon (:) or a semi colon (;). |
Output Format |
Format guidelines for the determined date. |
Return code |
---|
Date in the specified format. |
This script function adds years, months, quarters or weeks to a specified date.
This function is given a date. Optionally, you can specify a date format. The default date format to be used if nothing has been specified is either "YYMMDD" or "YYYYMMDD".Use a colon or semicolon as separator between Date Format and Date.
The Period is added to the specified Date. Period can be any number. An error will occur if the result dates later than 12/31/9999.
Output Format is optional. If it has not been specified, the script function returns the date in the default format "YYMMDD".
The first example adds two weeks to 03/6/2000. The result (20.03.2000) is output to the report.
:SET &DATE#=ADD_PERIOD ("DD.MM.YY:06.03.00","WW;2","DD.MM.YYYY")
:PRINT &DATE#
The second example adds a quarter to 01/31/2000. The result (30-04-2000) is output to the report.
:SET &DATE#=ADD_PERIOD ("000131","Q:1","DD-MM-YYYY")
:PRINT &DATE#
In the third example, a year is added to the date 02/29/2000. The result of 29.2.2001 is output to the report because the year 2001 is not a leap year.
:SET &DATE#=ADD_PERIOD ("20000229","YY:0001",DD.MM.YYYY)
:PRINT &DATE#
See also:
Script Elements - Date and Time
About Scripts
Script Element - Alphabetical Listing
Script Element - Listed by Function