SUB_TIME
Use the SUB_TIME script function to subtract one time value from another. The function handles the transition from 23:59:59 to 00:00:00 and returns the result in the time format you specify.
Syntax
SUB_TIME ([Time Format;]Time1, [Time Format;]Time2 [,Output Format])
Parameters
| Parameter | Description | Format | Default Value |
|---|---|---|---|
| Time1 | Time to subtract from, in HHMMSS format. To use a different format, enter it followed by a semicolon (;) before the time value. | script literal or script variable | n.a. |
| Time2 | Time to subtract, in HHMMSS format. To use a different format, enter it followed by a semicolon (;) before the time value. | script literal or script variable | n.a. |
| Output Format
(Optional) |
Time format for the returned value. | AE name, script literal or script variable | HHMMSS |
Examples
The following example subtracts one time from another without specifying a format. The result (110000) is printed in the default HHMMSS format.
: SET &TIME# = SUB_TIME ("120000", "010000" )
: PRINT &TIME#
The following example specifies a format for the second time and the output. The result (23:00) is printed 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, specifying formats for both input times but not the output. The result (235940) is printed 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 and specifies a seconds-only output format. The result (86380) is printed in the activation report.
: SET &TIME# = SUB_TIME ("HHMMSS;000010", "SS;30" , SS)
: PRINT &TIME#
See also: