public int compareTo(Date anotherDate){
  long thisTime=getMillisOf(this);
  long anotherTime=getMillisOf(anotherDate);
  return (thisTime < anotherTime ? -1 : (thisTime == anotherTime ? 0 : 1));
}

public int compareTo ( Date anotherDate ) { long thisTime = getMillisOf ( this ) ; long anotherTime = getMillisOf ( anotherDate ) ; return ( thisTime < anotherTime ? - 1 : ( thisTime == anotherTime ? 0 : 1 ) ) ; }
compares two dates for ordering .
