List of utility methods to do Calendar Night
Calendar | getMidnightCalendar() get Midnight Calendar Calendar calendar = getCurrentGMTCalendar();
setTimeToZero(calendar);
return calendar;
|
Calendar | getMidnightCalendarInstance() get Midnight Calendar Instance Calendar cal = Calendar.getInstance(NEW_YORK, Locale.US);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
|
Calendar | midnightOf(Calendar cal) midnight Of cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
|
void | setMidnight(Calendar cal) set Midnight cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.HOUR_OF_DAY, 0); |
Calendar | setMidnight(Calendar date) Set the time of a Calendar object to midnight by truncation. Calendar result = (Calendar) date.clone();
result.set(Calendar.HOUR_OF_DAY, 0);
result.set(Calendar.MINUTE, 0);
result.set(Calendar.SECOND, 0);
result.set(Calendar.MILLISECOND, 0);
return result;
|
void | setMidnight(final Calendar cal) Set the time component of the calendar to midnight. cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.HOUR_OF_DAY, 0); |
Calendar | toMidnightCalendar(Date date) Convert the time to the midnight of the given date or now if null. Calendar cal = Calendar.getInstance();
if (date != null) {
cal.setTime(date);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
...
|