SUB_TIME

Use the SUB_TIME script function to subtract time from a given time. The script function returns the result of the subtraction, in the time format that you specify. The calculation takes the change from 23:59:59 to 00:00:00 into account.

Syntax

SUB_TIME ([Time Format;]Time1, [Time Format;]Time2 [,Output Format])

Parameters

  • SUB_TIME
    Subtracts time from a given time

  • Time1,
    Time to subtract from, in HHMMSS format
    Format: script literal or script variable
    (Optional) To use a different format, enter the desired date format followed by a semicolon separator (;) and the date.

  • Time2
    Time to subtract, in HHMMSS format
    Format: script literal or script variable
    (Optional) To use a different format, enter the desired date format followed by a semicolon separator (;) and the date.

  • Output Format
    (Optional) time format for the time that the script function returns
    Format:AE name, script literal or script variable
    Default: HHMMSS

Examples

The following example subtracts the second time from the first time, without specifying a time format. The script prints the result (110000) in the default time format in the activation report.

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

The following defines a time format for the second time and for the output. The script prints the result (23:00) in the activation report.

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

The following example subtracts 30 seconds from 00:00:10. The script specifies the time formats for both times given, but not for the output. The script prints the result (235940) in the default format.

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

The following example subtracts 30 seconds from 00:00:10. The script specifies a format that only includes the seconds for the output. The script converts the result (23:59:40) into seconds and prints the number of seconds (86380) in the activation report.

:SET &TIME# = SUB_TIME("HHMMSS;000010", "SS;30", SS)
:
PRINT &TIME#

See also: