/** * Returns the first "standard" date (based on the specified field and * units). * * @param date the reference date. * @param unit the date tick unit. * * @return The next "standard" date. */ protected Date nextStandardDate(Date date, DateTickUnit unit) { Date previous = previousStandardDate(date, unit); Calendar calendar = Calendar.getInstance(this.timeZone, this.locale); calendar.setTime(previous); calendar.add(unit.getCalendarField(), unit.getMultiple()); return calendar.getTime(); }
/** * Returns the first "standard" date (based on the specified field and * units). * * @param date the reference date. * @param unit the date tick unit. * * @return The next "standard" date. */ protected Date nextStandardDate(Date date, DateTickUnit unit) { Date previous = previousStandardDate(date, unit); Calendar calendar = Calendar.getInstance(this.timeZone, this.locale); calendar.setTime(previous); calendar.add(unit.getCalendarField(), unit.getMultiple()); return calendar.getTime(); }
calendar.setTime(date); int count = unit.getCount(); int current = calendar.get(unit.getCalendarField()); int value = count * (current / count);
calendar.setTime(date); int count = unit.getMultiple(); int current = calendar.get(unit.getCalendarField()); int value = count * (current / count);