differenceInCalendarUnits

differenceInCalendarUnits( timeUnit, time1, time2 )

Description

Returns the difference (time2 - time1) between two model dates (corresponding to the given model times) in the given time units. Result is the number of date units that should be added to the model time time1 to obtain time2. The result may be negative and may have fractional part depending on the given dates.

Parameter

Name

Type of value

Description

units

One of the following

constants:

MILLISECOND

SECOND

MINUTE

HOUR

DAY

WEEK

MONTH

YEAR

Defines the time units.

time1

double

The first model time.

time2

double

The second model time.

Result

Type

Description

double

The difference (time2 - time1) in the given date units.