Why does this keep returning 0?
Calendar calendar = Calendar.getInstance();
calendar.get(Calendar.HOUR_OF_DAY)?
Calendar.HOUR_OF_DAY will be 0 whenever the hour of the day falls between between midnight and one o'clock in the morning. So chances are, either it is in that time interval wherever you are, or your Android emulator is set up so it thinks you're in that time interval.
If that's not the case, you could try setting the hour to some arbitrary value and then getting it again to check that it's working. To do that, try:
Calendar cal = Calendar.getInstance();
cal.set(Calendar.HOUR_OF_DAY, 5);
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