ADD_PERIOD

ScriptEigener Objekttyp in der Automation Engine Function: Adds a period to a specified date.

Syntax

ADD_PERIOD(Date, Period Format:Period, [Output Format])

Syntax

Description/Format

Date

Period Format:Period

Format: script literal or script variable

Period: Entry of a period to be added to specified date.
Period Format: Format guidelines for the Period.

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.
Format: AE name, script literal or script variable
Default value: "YYMMDD" 


Return code

Date in the specified format.

Comments

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".

Examples

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

Date, Time and Period Formats

About Scripts
Script Element - Alphabetical Listing

Script Element - Listed by Function