package check;
import java.util.Calendar;
public class Test {
public static void main(String[] args) {
// length of a day
long DAY_MILLIS = 1000 * 60 * 60 * 24;
Calendar cal = Calendar.getInstance();
cal.set(1900, 0, 1, 0, 0, 0);
System.out.println(cal.getTime());
cal.setTimeInMillis(cal.getTimeInMillis() + DAY_MILLIS);
System.out.println(cal.getTime());
}
}
And it's result is:
Mon Jan 01 00:00:00 KST 1900
Mon Jan 01 23:30:00 KST 1900 // Where is 30 minutes here?
Most funny and important clue is that this problem happens when year is 1900 only.