Ashif_Mujtoba
Ashif_Mujtoba

Reputation: 1

Calendar.HOUR_OF_DAY always showing 1 hour advance and 12 Hour Format

My code

    Calendar calendar = Calendar.getInstance();
    thisHour = calendar.get(Calendar.HOUR_OF_DAY);
    Log.e(TAG + "--thisHour: ",String.valueOf(thisHour));

So this should print the hour of day as 24 hour format. When tried, then Time was 2.10pm so it should print 14. But it always print in log 3. I tried at other times too but same result. Always print time 1 hour advance and in 12 hour format. What have I done wrong ! Need guidline

Upvotes: 0

Views: 530

Answers (1)

mawalker
mawalker

Reputation: 2070

This sounds like an issue related to timezone or daylight savings, etc.

Have you tried getTime() and getTimeZone() to verify that the information being returned is what you expect? or even toString() which should print everything in a readable format for you.

Upvotes: 1

Related Questions