Java Utililty Methods Hour

List of utility methods to do Hour

Description

The list of methods to do Hour are organized into topic(s).

Method

booleanisHour(int hour)
is Hour
return getHourOfDay() == hour;
DatenextHour(Date date)
next Hour
long now = date.getTime();
int min = Integer.valueOf(minuteFormat.format(date));
int sec = Integer.valueOf(secondFormat.format(date));
long begin = now - min * 60 * 1000 - sec * 1000;
long end = begin + 60 * 60 * 1000;
return new Date(end);
DatenextHour(int hour)
next Hour
Calendar now = now();
now.set(Calendar.HOUR_OF_DAY, now.get(Calendar.HOUR_OF_DAY) + hour);
return now.getTime();
longresetHourMillisToZero(long millis)
reset Hour Millis To Zero
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(millis);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTimeInMillis();
Datetomrrow(int hour, int minute, int second)
tomrrow
return nextDay(1, hour, minute, second);