List of utility methods to do Calendar Hour
long | elapsedHours(Calendar aFirstDate, Calendar aSecondDate) elapsed Hours return Math.abs(millisToHours(aSecondDate.getTimeInMillis() - aFirstDate.getTimeInMillis()));
|
Integer | get24Hour(Calendar calendar) get Hour Integer hour = calendar.get(Calendar.HOUR_OF_DAY);
return hour;
|
int | getHour(boolean twentyFour, Calendar calendar) get Hour return calendar.get(twentyFour ? Calendar.HOUR_OF_DAY : Calendar.HOUR);
|
int | getHour(Calendar cal) get Hour int hr = cal.get(Calendar.HOUR); return (hr == 0 ? 12 : hr); |
String | getHour(Calendar cal) get Hour return strLen(String.valueOf(cal.get(Calendar.HOUR_OF_DAY)), 2);
|
int | getHour(Calendar calendar) get Hour return calendar.get(Calendar.HOUR_OF_DAY);
|
int | hour(Calendar calendar) hour return calendar.get(Calendar.HOUR_OF_DAY);
|
void | hourFloor(Calendar calendar) hour Floor minuteFloor(calendar); calendar.set(Calendar.MINUTE, 0); |
int | hoursInDay(Calendar cal) This function returns number of hour in a day when given a Calendar with appropriate TZ. Calendar localCal = new GregorianCalendar(cal.getTimeZone()); localCal.set(Calendar.MILLISECOND, 0); localCal.set(cal.get(Calendar.YEAR), cal.get(Calendar.MONTH), cal.get(Calendar.DAY_OF_MONTH), 0, 30, 0); localCal.add(Calendar.HOUR_OF_DAY, 24); switch (localCal.get(Calendar.HOUR_OF_DAY)) { case 1: return 23; case 23: ... |
Calendar | moveHoursHand(int aNumberOfHours, Calendar aCalendar) move Hours Hand Calendar clone = clone(aCalendar);
clone.add(Calendar.HOUR_OF_DAY, aNumberOfHours);
return clone;
|