DIFF_TIME

Script Function: Returns the difference between two time entries

DIFF_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

This script function returns the difference between Time1 and Time2. The time difference is always calculated between the current earlier time to the later time. Therefore, it makes no difference whether the later time is Time1 or Time2.

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. If special terms are used with Time Format, the specified number of hours, minutes and seconds is calculated. "00" is currently used for missing information. 

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 returns the difference between the time entries. The times use the default format "HHMMSS". The result "003000" is output in the report.

:SET &DIFF# = DIFF_TIME("230000", "223000")
:
PRINT &DIFF#

In this example, a special term is used for the second time entry. As a result, the hours and seconds are automatically "00". An output format is predetermined. The result "00:09" appears in the report.

:SET &DIFF# = DIFF_TIME("HH:MM:SS;00:01:30", "MM;11", "HH:MM")
:
PRINT &DIFF#

In the third example, the times are assigned to the script variables. The script function is called with these script variables. Because the time does not use the default format, the special time format must also be specified for the script variables. The result "120000" is output in the report.

:SET &TIME1# = "00:00:00"
:
SET &TIME2# = "12:00:00"
:
SET &DIFF# = DIFF_TIME("HH:MM:SS;&TIME1#", "HH:MM:SS;&TIME2#")
:
PRINT &DIFF# 

See also:

Script Elements - Date and Time

Date, Time and Period Formats

About Scripts
Script Elements - Alphabetical Listing

Script Elements - Ordered by Function