What is the difference between Calendar.HOUR
and Calendar.HOUR_OF_DAY
? When to use Calendar.HOUR
and Calendar.HOUR_OF_DAY
? I am confused sometime Calendar.HOUR
this works fine and othertime Calendar.HOUR_OF_DAY
this works fine. What they return in the form of int? I have read this documentation but not understood the difference. Any suggestions Thanks.
From http://docs.oracle.com/javase/7/docs/api/java/util/Calendar.html#HOUR:
Calendar.HOUR = Field number for get and set indicating the hour of the morning or afternoon. HOUR is used for the 12-hour clock. E.g., at 10:04:15.250 PM the HOUR is 10.
Calendar.HOUR_OF_DAY = Field number for get and set indicating the hour of the day. HOUR_OF_DAY is used for the 24-hour clock. E.g., at 10:04:15.250 PM the HOUR_OF_DAY is 22.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With