List of utility methods to do Calendar Add
void | appendEra(StringBuffer sb, Calendar cal) append Era if (cal.get(Calendar.ERA) == GregorianCalendar.BC) { sb.append(" BC"); |
void | appendTime(Calendar value, StringBuffer dateString) append Time if (value.get(Calendar.HOUR_OF_DAY) < 10) { dateString.append("0"); dateString.append(value.get(Calendar.HOUR_OF_DAY)).append(":"); if (value.get(Calendar.MINUTE) < 10) { dateString.append("0"); dateString.append(value.get(Calendar.MINUTE)).append(":"); ... |
void | appendTimeZone(Calendar calendar, StringBuffer dateString) append Time Zone int timezoneOffSet = calendar.get(Calendar.ZONE_OFFSET) + calendar.get(Calendar.DST_OFFSET); int timezoneOffSetInMinits = timezoneOffSet / 60000; if (timezoneOffSetInMinits < 0) { dateString.append("-"); timezoneOffSetInMinits = timezoneOffSetInMinits * -1; } else { dateString.append("+"); int hours = timezoneOffSetInMinits / 60; int minits = timezoneOffSetInMinits % 60; if (hours < 10) { dateString.append("0"); dateString.append(hours).append(":"); if (minits < 10) { dateString.append("0"); dateString.append(minits); |
Calendar | cloneAndAdd(Calendar source, int field, int amount) clone And Add Calendar r = (Calendar) source.clone();
r.add(field, amount);
return r;
|
Calendar | getDayOfAddDay(final Calendar calendar, final int day) get Day Of Add Day Calendar cln = Calendar.getInstance();
cln.setTimeInMillis(calendar.getTimeInMillis());
cln.add(Calendar.DAY_OF_MONTH, day);
return cln;
|
Calendar | getStartDateForLogQuery(int calendarField, int amountToAdd) get Start Date For Log Query Calendar startDate = Calendar.getInstance();
startDate.set(Calendar.HOUR_OF_DAY, 0);
startDate.set(Calendar.MINUTE, 0);
startDate.set(Calendar.SECOND, 0);
startDate.set(Calendar.MILLISECOND, 0);
startDate.add(calendarField, amountToAdd);
return startDate;
|
GregorianCalendar | getWithDaysAdded(GregorianCalendar originalDate, int days) Returns a new GregorianCalendar instance that is the specified value plus the specified number of days added. GregorianCalendar newDate = (GregorianCalendar) originalDate.clone();
newDate.add(Calendar.DAY_OF_MONTH, days);
return newDate;
|
void | moveToCalendarSecondJustAdded(Calendar cal, int seconds) move To Calendar Second Just Added addCalendarSecond(cal, seconds); moveToCalendarSecondJust(cal); |