比较两个日期的大小

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;
}

猜你喜欢

转载自blog.csdn.net/qq_26320085/article/details/93761105