List of utility methods to do Hour
Date | getHoursByDate(Date date, int hours) get Hours By Date GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date); cal.add(Calendar.HOUR_OF_DAY, hours); return cal.getTime(); |
long | getHoursOfTowDiffDate(String p_startDate, String p_endDate) get Hours Of Tow Diff Date return (long) getMillisOfTowDiffDate(p_startDate, p_endDate) / (1000 * 60 * 60); |
String | getLastHour() get Last Hour SimpleDateFormat sf = new SimpleDateFormat("yyyyMMddHH"); Calendar cl = Calendar.getInstance(); cl.set(cl.get(cl.YEAR), cl.get(cl.MONTH), cl.get(cl.DAY_OF_MONTH), cl.get(cl.HOUR_OF_DAY) - 1, 0, 0); return sf.format(cl.getTime()); |
String | getLasthour() get Lasthour Calendar cal = Calendar.getInstance(); cal.add(Calendar.HOUR_OF_DAY, -1); String yesterday = new SimpleDateFormat("yyyy-MM-dd HH").format(cal.getTime()); return yesterday; |
int | getMinOfHour(long l1) get Min Of Hour Calendar cal1 = Calendar.getInstance();
cal1.setTimeInMillis(l1);
return cal1.get(Calendar.MINUTE);
|
int | getPreHour() get Pre Hour Calendar now = Calendar.getInstance();
now.add(Calendar.HOUR_OF_DAY, -1);
return now.get(Calendar.HOUR_OF_DAY);
|
String | getPreHourText(String pattern) get Pre Hour Text Calendar c = Calendar.getInstance();
return getPreHourText(c.getTime(), pattern);
|
Date | getPrevHour(Date date) get Prev Hour return new Date(date.getTime() - 60 * MINUTE_MILLISECONDS); |
int | getSecondsPassedInHour() get Seconds Passed In Hour Calendar cur = GregorianCalendar.getInstance(); Calendar calendar = GregorianCalendar.getInstance(); calendar.set(cur.get(Calendar.YEAR), cur.get(Calendar.MONTH), cur.get(Calendar.DATE), cur.get(Calendar.HOUR_OF_DAY), 0); long currenttime = cur.getTime().getTime(); long hourtime = calendar.getTime().getTime(); long millis = currenttime - hourtime; int result = (int) (millis / 1000); ... |
Date | getTaskTrigger(int taskTriggerHour, boolean tomorrow) Get date of next time for triggering task return getTaskTrigger(taskTriggerHour, 0, tomorrow);
|