code: public int compareTo(Date anotherDate) {
          long thisTime = getMillisOf(this);
          long anotherTime = getMillisOf(anotherDate);
          return (thisTime<anotherTime ? -1 : (thisTime==anotherTime ? 0 : 1));
      }
docs: Compares two Dates for ordering.
  
  @param   anotherDate   the <code>Date</code> to be compared.
  @return  the value <code>0</code> if the argument Date is equal to
  this Date; a value less than <code>0</code> if this Date
  is before the Date argument; and a value greater than
  <code>0</code> if this Date is after the Date argument.
  @since   1.2
  @exception NullPointerException if <code>anotherDate</code> is null.