ADD_DAYS

ScriptEigener Objekttyp in der Automation Engine Function: Adds days to a given date

Syntax

ADD_DAYS(Date, Days, [[Calendar], [Calendar Keyword]])

Syntax

Description/Format

Date

Days

A value specifying a number of days.
Format: script literal, number without quotation marks or script variable

Calendar

The name of the relevant Calendar object.
Format: AE name, script literal or script variable

Calendar Keyword

The name of the relevant calendar keyword.
Format: AE name, script literal or script variable


Return code

Date in the specified format
"0" - No days have been assigned to this calendar keyword or the calculated date lies out of the calendar range.
"20327" - Calendar object does not exist
"20328" - Calendar keyword does not exist in the Calendar object

Comments

This function adds Days to a given Date. Optionally, this calculation can also be made depending on Calendar and Calendar Keyword. Only Days which have been defined in the calendar keyword will be taken into account.

If you specify a particular date format, the date will be returned in this format. Otherwise, the default formats "YYMMDD" or "YYYYMMDD" must be used and will be returned . Use a colon or semicolon as a separator between Date Format and Date.

It is also possible to specify zero Days. If the Date is valid according to the Calendar, this date will be returned. If it is not valid, the previous valid date (calendar conditions) will bereturned.

The range of the specified calendar is automatically considered in the calendar calculation. This range depends on the settings the administrator defined in the variable UC_CLIENT_SETTINGS in the keys NOW_MINUS and NOW_PLUS. The script function returns "0" if the calculated date lies beyond this defined range.

Examples

The first example adds two days to the specified date. The result ("000401") is output to the activation protocol.

:SET &DATE# = ADD_DAYS("000330", 2)
:
PRINT &DATE#

In this example, the date is assigned to a script variable. The default format "YYMMDD" will be used because no date format has been specified. The result ("000401") is again output in the activation protocol.

:SET &DATE1# = "000330"
:
SET &DATE2# = ADD_DAYS(&DATE#, 2)
:
PRINT &DATE2#

The third example retrieves the next valid work day. This is done using the definitions made in the company calendar. As the current date was not retrieved in the default format, the special date format must again be specified in the script variable.

:SET &CURDATE# = SYS_DATE("DD.MM.YY")
:
SET &NWRKDAY# = ADD_DAYS("DD.MM.YY:&CURDATE#", 1, COMPANY, WORKDAY)

See also:

Script Elements - Date and Time

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function