我应该使用 Calendar.compareTo() 来比较日期吗?
这是比较日期的有效方法吗:
Calendar someCalendar1 = Calendar.getInstance(); // current date/time
someCalendar1.add(Calendar.DATE, -14);
Calendar someCalendar2 = Calendar.getInstance();
someCalendar2.setTime(someDate); // someDate is in the format of MM/dd/yyyy
if(someCalendar2.compareTo(someCalendar1) < 0){
...Code...
}
...还是有更好的方法?