B
bort
Hi all
I have two dates entered into two separate Calendar objects(checkin and
checkout). For "checkin" I set the year to 2004, the month to 1, and the
date to 31. For "checkout" I set the year to 2004, the month to 2, and the
date to 1.
i.e.
checkin --> January 31, 2004
checkout --> February 1, 2004
Now, when I compare the two dates, to ensure that the checkout is AFTER the
checkin, I get the unexpected result that the checkout date is BEFORE the
checkin date!
Does anyone know why? My code snippet is as follows:
Calendar checkin = Calendar.getInstance();
checkin.clear();
checkin.set(2004, 1, 31);
Calendar checkout = Calendar.getInstance();
checkout.clear();
checkout.set(2004, 2, 1);
if (!checkout.after(checkin)) {
System.out.println("do something");
}
TIA,
bort
I have two dates entered into two separate Calendar objects(checkin and
checkout). For "checkin" I set the year to 2004, the month to 1, and the
date to 31. For "checkout" I set the year to 2004, the month to 2, and the
date to 1.
i.e.
checkin --> January 31, 2004
checkout --> February 1, 2004
Now, when I compare the two dates, to ensure that the checkout is AFTER the
checkin, I get the unexpected result that the checkout date is BEFORE the
checkin date!
Does anyone know why? My code snippet is as follows:
Calendar checkin = Calendar.getInstance();
checkin.clear();
checkin.set(2004, 1, 31);
Calendar checkout = Calendar.getInstance();
checkout.clear();
checkout.set(2004, 2, 1);
if (!checkout.after(checkin)) {
System.out.println("do something");
}
TIA,
bort