SUB_TIME

Script Function: Subtracts two times

Syntax

SUB_TIME ([Time Format;]Time1, [Time Format;]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 afterward 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

With this script function you subtract two times. The change from 23:59:59 to 00:00:00 is taken into account.

The script function is assigned two times. Optionally, you may specify a particular time format. If no particular Time Format has been defined, the time must be specified in the default format "HHMMSS". Only a semicolon may be used as a separator between Time Format and the time.

Output Format is optional. If Output Format is not used, the script function returns a time with the default format "HHMMSS".

Examples

The first example does not use a time format. The result ("110000") is output in the activation protocol.

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

The second example uses time format and output format. The result is "23:00".

:SET &TIME# = SUB_TIME("040000", "HH;05", "HH:MM")
:
PRINT &TIME#

In the third example, 31 seconds are subtracted from 00:00:10. Time format is used, output format is not. The result ("235940") corresponds to the default format.

:SET &TIME# = SUB_TIME("HH:MM:SS;00:00:10", "SS;30")
:
PRINT &TIME#

Same example as the third. The difference is that a special term is used for the output format. The result ("86380") is the conversion of 23:59:40 into seconds.

:SET &TIME# = SUB_TIME("HHMMSS;000010", "SS;30", 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