List of utility methods to do Calendar Minute
Calendar | calendarTodayOf(int hour, int minute, int second, int millis) calendar Today Of Calendar calendar = Calendar.getInstance();
return setCalendarTime(calendar, hour, minute, second, millis);
|
void | clearHoursMinutesSecondsMillis(Calendar calendar) clear Hours Minutes Seconds Millis calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); |
Calendar | getFirstMinuteOfDay(Calendar dt) Get Calendar (am 00:00) if (null == dt) { return null; Calendar calendar = dt; Calendar rtnCalendar = Calendar.getInstance(); rtnCalendar.clear(); rtnCalendar.set(Calendar.YEAR, calendar.get(Calendar.YEAR)); rtnCalendar.set(Calendar.MONTH, calendar.get(Calendar.MONTH)); ... |
String | getMinute(Calendar cal) get Minute return strLen(String.valueOf(cal.get(Calendar.MINUTE)), 2);
|
int | getMinutes(Calendar cal) get Minutes return cal.get(Calendar.MINUTE);
|
int | getMinutes(Calendar cal1, Calendar cal2) get Minutes long utc1 = cal1.getTimeInMillis(); long utc2 = cal2.getTimeInMillis(); long result = (utc2 - utc1) / (SECONDS_60 * MILLI_SECONDS_1000); return (int) result; |
Date | getMinutes(String expression, Calendar time) get Minutes int hr; int mins; int day; int month; Calendar cal = Calendar.getInstance(); cal.setTime(time.getTime()); if (expression.contains("now")) { hr = getInt(expression, 0); ... |
int | getMinutesInterval(Calendar start, Calendar end) get Minutes Interval if (start.after(end)) throw new IllegalArgumentException("Start time must preceede End time."); int minutes = end.get(Calendar.MINUTE) - start.get(Calendar.MINUTE); minutes += 60 * (end.get(Calendar.HOUR_OF_DAY) - start.get(Calendar.HOUR_OF_DAY)); minutes += 24 * 60 * Math.abs(end.get(Calendar.DAY_OF_WEEK) - start.get(Calendar.DAY_OF_WEEK)); return minutes; |
int | getOffsetInMinutes(Calendar cal) get Offset In Minutes int offset = cal.get(Calendar.ZONE_OFFSET); offset += cal.get(Calendar.DST_OFFSET); offset /= (1000 * 60); return offset; |
boolean | isNow(Calendar cal, Locale locale, boolean minuteCheck) is Now if (isToday(cal)) { Calendar today = Calendar.getInstance(locale); if (today.get(Calendar.HOUR_OF_DAY) == cal.get(Calendar.HOUR_OF_DAY)) { if (!minuteCheck) { return true; if (today.get(Calendar.MINUTE) == cal.get(Calendar.MINUTE)) { return true; ... |