List of utility methods to do Hour
Integer | convertHour(Long createAt) convert Hour Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(createAt);
return cal.get(Calendar.HOUR);
|
long | delayBeforeNextHour() delay Before Next Hour return nextHour().getTime() - System.currentTimeMillis();
|
int | get24Hour() get Hour return calendar.get(Calendar.HOUR_OF_DAY);
|
long | getAlarmOnQuarterHour() Setup to find out when the quarter-hour changes (e.g. Calendar nextQuarter = Calendar.getInstance(); nextQuarter.set(Calendar.SECOND, 1); nextQuarter.set(Calendar.MILLISECOND, 0); int minute = nextQuarter.get(Calendar.MINUTE); nextQuarter.add(Calendar.MINUTE, 15 - (minute % 15)); long alarmOnQuarterHour = nextQuarter.getTimeInMillis(); long now = System.currentTimeMillis(); long delta = alarmOnQuarterHour - now; ... |
Calendar | getAnHourBack() get An Hour Back return getAnHourBack(new Date()); |
String | getBeforeOneHour() get Before One Hour Calendar cal = Calendar.getInstance(); cal.setTime(new Date()); return String.valueOf(cal.get(Calendar.HOUR_OF_DAY) == 0 ? 23 : cal.get(Calendar.HOUR_OF_DAY) - 1); |
Calendar | getCalenderWithHour(int hours) get Calender With Hour Calendar cal = Calendar.getInstance(TimeZone.getTimeZone("UTC")); cal.add(Calendar.HOUR, hours); return cal; |
String | getCurrentHour() get Current Hour Calendar calendar; calendar = new GregorianCalendar(); String hour = Integer.toString(calendar.get(Calendar.HOUR_OF_DAY)); return hour; |
Date | getCurrentHour() get Current Hour Calendar cal = Calendar.getInstance();
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal.getTime();
|
float | getCurrentHour() get Current Hour Calendar cal = Calendar.getInstance();
return cal.get(Calendar.HOUR_OF_DAY) + cal.get(Calendar.MINUTE) / 60f;
|