DiffMinutes

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

Syntax

DiffMinutes (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. You can enter the Time parameters in any order. It does not matter which Time parameter is earlier.

Example

Here is an example:

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

Function

Result

Explanation

DiffMinutes

("2:04:34PM", 2, )

120

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

See also