wood burning stoves
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
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="http://www.oreilly.com/catalog/jswing2" target="_blank" rel="nofollow">Java Swing</a><br />Co-Creator of <a href="http://www.sun.com/training/catalog/courses/CX-310-055.xml" target="_blank" rel="nofollow">SCJP 5.0</a> and <a href="http://www.sun.com/training/certification/java/associate_beta.xml" target="_blank" rel="nofollow">SCJA</a> exams
Antonio Giovanni
Ranch Hand

Joined: Jun 27, 2005
Posts: 85

Thanks a lot
I agree. Here's the link: http://aspose.com/file-tools
subject: Calendar class Regarding...
It's not a secret anymore!