日期:2014-05-20 浏览次数:21011 次
Date d1 = xxx; Date d2 = yyy; Calendar c1 = Calendar.getInstance(); Calendar c2 = Calendar.getInstance(); c1.setTime(d1); c2.setTime(d2); c1.set(Calendar.SECOND, 0); c1.set(Calendar.MILLISECOND, 0); c2.set(Calendar.SECOND, 0); c2.set(Calendar.MILLISECOND, 0); if (c1.before(c2)) { System.out.println("c1 is smaller than c2"); } else if (c1.after(c2)) { System.out.println("c1 is bigger than c2"); } else { System.out.println("c1 equals c2"); }