DiffSeconds

Use this function to calculate the absolute time difference in seconds between two times. The system returns an integer value.

Syntax

DiffSeconds (Time1, Format1, Time2, Format2)

Parameter

Description

Time1

Enter a time string. The system assumes this time string is in the format specified by the Format1 parameter. The default is the current time.

Format1

Enter a time format string that describes the Time1 parameter. The default is time format 1 (HH:MM:SS).

Time2

Enter a time string. The system assumes this time string is in the format specified by the Format2 parameter. The default is the current time.

Format2

Enter a time format string that describes the Time2 parameter. The default is time format 1.

The difference between two times is always positive. It does not matter which time string is larger.

Example

Here is an example:

(Assume the current time is 4:04:34 pm.)

Function

Result

Explanation

DiffSeconds ("2:04:35PM", 2, )

7199

The second parameter defaults to the current time. The resulting difference in seconds between the given time and the current time is a total of 7199 seconds.

See also