compareTo()

Compares the time values represented by two Calendar objects.

Syntax

Numeric compareTo(Calendar other)
  1. other is the calendar to compare.

Usage

The time value is expressed in millisecond offsets from the Epoch January 1, 1970 00:00:00.000 GMT Gregorian.

This method returns:

  • 0 if the time represented by the argument is equal to the time represented by this Calendar.
  • A value less than 0 if the time of this Calendar is before the time represented by the argument.
  • A value greater than 0 if the time of this Calendar is after the time represented by the argument.