Java Utililty Methods Calendar Night

List of utility methods to do Calendar Night

Description

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

Method

CalendargetMidnightCalendar()
get Midnight Calendar
Calendar calendar = getCurrentGMTCalendar();
setTimeToZero(calendar);
return calendar;
CalendargetMidnightCalendarInstance()
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;
CalendarmidnightOf(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;
voidsetMidnight(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);
CalendarsetMidnight(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;
voidsetMidnight(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);
CalendartoMidnightCalendar(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);
...