Automation Engine Script Guide > Ordered by Function > Date and Time > ADD_TIME

ADD_TIME

Script Function: Adds two times.

Syntax

ADD_TIME(Time1, Time2, [Output Format])

Syntax

Description/Format

Time1
and

Time2

Indication of a time in the format "HHMMSS". 

Format: script literal or script variable

It is also possible to specify a different time format. Do so by entering the required time format, then enter a separator (;) and afterwards the time. Indicating a time format is optional.

Output Format

Format for the determined time.
Format: AE name, script literal or script variable
Default: "HHMMSS"


Return code

Time in the specified format

Comments

Two times are added with this script function. The change from 23:59:59 to 00:00:00 is taken into account.

This script function is assigned two times. The indication of a particular time format is optional. The default time format to be used if nothing has been specified is "HHMMSS". Use a semicolon as a separator between the time format and the time.

Output Format is optional. If nothing has been specified, the script function returns the time in the default format "HHMMSS".

Examples

The first example does not use any time formats. The result ("130000") is output in the activation protocol.

:SET &TIME# = ADD_TIME("120000","010000")
:
PRINT &TIME#

The second example uses time and output format. The result is "04:59".

:SET &TIME# = ADD_TIME("235959", "HH;05", "HH:MM")
:
PRINT &TIME#

In the third example, 71 seconds are added to 23:59:59 71. Time format is used, output format is not used. The result ("000110") is output in the default format.

:SET &TIME# = ADD_TIME("HH:MM:SS;23:59:59", "SS;71")
:
PRINT &TIME#

The following example is the same as the third one shown above. The difference is that a special term is used for the output format. The result ("70") is output in the activation protocol in seconds.

:SET &TIME# = ADD_TIME("HHMMSS;235959", "SS;71", SS)
:
PRINT &TIME#

 

See also:

Script Elements - Date and Time

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function