List of utility methods to do Calendar Day
void | moveToCalendarDay(Calendar cal, int day) move To Calendar Day assertArgumentNotMinusNotZeroInteger("day", day);
cal.set(Calendar.DAY_OF_MONTH, day);
|
void | moveToCalendarDayJust(Calendar cal) move To Calendar Day Just moveToCalendarDayJust(cal, cal.getActualMinimum(Calendar.HOUR_OF_DAY)); |
Calendar | newCalendarForDay(Date date) new Calendar For Day Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.HOUR, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
cal.set(Calendar.MILLISECOND, 0);
return cal;
|
void | resetToBeginningOfDay(Calendar c) reset To Beginning Of Day c.set(Calendar.HOUR_OF_DAY, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); |
boolean | sameDay(Calendar a, Calendar b) same Day return a.get(Calendar.DAY_OF_YEAR) == b.get(Calendar.DAY_OF_YEAR)
&& a.get(Calendar.MONTH) == b.get(Calendar.MONTH) && a.get(Calendar.YEAR) == b.get(Calendar.YEAR);
|
boolean | sameDay(Calendar c1, Calendar c2) same Day return c1.get(Calendar.YEAR) == c2.get(Calendar.YEAR)
&& c1.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR);
|
boolean | sameDay(Calendar one, Calendar two) Returns true if the two given calendars are dated on the same year, month and day. return one.get(Calendar.DATE) == two.get(Calendar.DATE) && sameMonth(one, two);
|
void | setDayToCalendar(int days, Calendar calendar) Converts the number of elapsed days from 0001/01/01 (YYYY/MM/DD) to the corresponded date, and set it to the target calendar object. int year = getYearFromDay(days); int daysInYear = days - getDayFromYear(year); boolean leap = isLeap(year); int month = getMonthOfYear(daysInYear, leap); int day = getDayOfMonth(daysInYear, leap); calendar.set(year, month - 1, day, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); |
Calendar | setEndDay(Calendar cal) set End Day cal.set(11, 23);
cal.set(12, 59);
cal.set(13, 59);
return cal;
|
void | setStartOfDay(final Calendar calendar) set Start Of Day calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); |