Calendar cal1 = new GregorianCalendar(2007, Calendar.SEPTEMBER, 1);
Calendar cal2 = new GregorianCalendar(2007, Calendar.SEPTEMBER, 15);
// Determine which is earlier
boolean b = cal1.after(cal2); // false
b = cal1.before(cal2); // true
// Get difference in milliseconds
long diffMillis = cal2.getTimeInMillis()-cal1.getTimeInMillis(); //1209600000
Subscribe to:
Post Comments (Atom)
0 comments:
Post a Comment