Comparing two dates

public static int compareDate(Date startDate, Date endDate) {
   long startTime = startDate.getTime();
   long endTime = endDate.getTime();
   if (startTime < endTime) {
      return -1;
   }
   if (startTime == endTime) {
      return 0;
   }
   return 1;
}

Guess you like

Origin blog.csdn.net/qq_26320085/article/details/93761105
Recommended