Skip to Main Content

Java Programming

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Calender add method

807606May 23 2007 — edited May 24 2007
Hi I have the following code,
Calendar calendar = Calendar.getInstance();
calendar.set(1996, 4, 24, 0, 0, 0);

System.out.println(calendar.getTime());

calendar.add(Calendar.DAY_OF_YEAR, 1);

System.out.println(calendar.getTime());
this prints
Fri May 24 00:00:00 LKT 1996
Sat May 25 01:00:00 LKT 1996

Why has the hour increased to 1? This doesn't happen for 1995.. :(

Thanks,
Gavin
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 21 2007
Added on May 23 2007
7 comments
98 views