List of utility methods to do Hour
String | getHourMinuteString(Date t) get Hour Minute String c1.setTime(t); String hour = c1.get(Calendar.HOUR_OF_DAY) < 10 ? "0" + c1.get(Calendar.HOUR_OF_DAY) : Integer.toString(c1.get(Calendar.HOUR_OF_DAY)); String minute = c1.get(Calendar.MINUTE) < 10 ? "0" + c1.get(Calendar.MINUTE) : Integer.toString(c1.get(Calendar.MINUTE)); return hour + ":" + minute; |
String | getHourOfDay(Calendar date) gets the hour-of-day of the given date String hourOfDay = HOUR_FORMATTER.format(date.get(Calendar.HOUR_OF_DAY));
return hourOfDay;
|
int | getHourOfDay(final Date date) Get the hour of the day by given date. return getNumberOfGranularity(Calendar.HOUR_OF_DAY, date);
|
int | getHourOfDayInAm(Date dt) Returns an hour in AM Calendar cal = new GregorianCalendar(); cal.setTime(dt); int hour = cal.get(Calendar.HOUR_OF_DAY); if (hour > 12) { hour = hour - 12; return hour; |
int | getHourOfWeek(Date dateIn) Returns the hour of the week in the range of 1 to 168. if (dateIn == null) { throw new IllegalArgumentException("Can not operate on a null Date object."); Calendar cal = Calendar.getInstance(); cal.setTime(dateIn); return ((cal.get(Calendar.DAY_OF_WEEK) - 1) * 24) + cal.get(Calendar.HOUR_OF_DAY); |
int | getHours() get Hours Calendar now = Calendar.getInstance();
return now.get(Calendar.HOUR);
|
int | getHours() get Hours return Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
|
int | getHours(Date t, Date baseDate) Get hours difference between two dates Calendar cal = Calendar.getInstance(); cal.setTime(baseDate); long sl = cal.getTimeInMillis(); long el, delta; cal.setTime(t); el = cal.getTimeInMillis(); delta = el - sl; int value = (int) (delta / (60 * 60 * 1000)); ... |
int | getHours(final Date date) The Method from the Date.getHours is deprecated. final Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return calendar.get(Calendar.HOUR_OF_DAY); |
int | getHours(java.util.Date _date) get Hours Calendar calendar = Calendar.getInstance(); calendar.setTime(_date); int value = calendar.get(Calendar.HOUR); calendar.clear(); return value; |