File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes Calendar class Regarding... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of REST with Spring (video course) this week in the Spring forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Calendar class Regarding..." Watch "Calendar class Regarding..." New topic

Calendar class Regarding...

Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85
Hi all,

Please look at the code...

The Result that is showing up is
00:00 when i mention String am_pm="PM";

When i mention String am_pm="AM"; the result showing up is

THe results are in reverse order !!! What's going wrong... or some kind of a bug !!!..

Please share your comments..

Dave Wood
Ranch Hand

Joined: Aug 02, 2004
Posts: 161
I think the answer lies in the javadoc for Calendar.HOUR:


public static final int HOUR

Field number for get and set indicating the hour of the morning or afternoon. HOUR is used for the 12-hour clock (0 - 11). Noon and midnight are represented by 0, not by 12. E.g., at 10:04:15.250 PM the HOUR is 10.

Co-Author of <a href="" target="_blank" rel="nofollow">Java Swing</a><br />Co-Creator of <a href="" target="_blank" rel="nofollow">SCJP 5.0</a> and <a href="" target="_blank" rel="nofollow">SCJA</a> exams
Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85

Thanks a lot
subject: Calendar class Regarding...
It's not a secret anymore!