Android Utililty Methods Day Add

List of utility methods to do Day Add

Description

The list of methods to do Day Add are organized into topic(s).

Method

DateaddDayOfMonth(Date date)
add Day Of Month
Calendar calendar = calendarDate(date);
calendar.add(Calendar.DAY_OF_MONTH, 1);
return calendar.getTime();
DateaddDayOfMonth(Date date, int difference)
add Day Of Month
Calendar calendar = calendarDate(date);
calendar.add(Calendar.DAY_OF_MONTH, difference);
return calendar.getTime();
longaddDay(long dateTimeMillis)
add Day
Calendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(dateTimeMillis);
calendar.add(Calendar.DATE, 1);
return calendar.getTimeInMillis();
longaddDay(long dateTimeMillis)
add Day
Calendar calendar = new GregorianCalendar();
calendar.setTimeInMillis(dateTimeMillis);
calendar.add(Calendar.DATE, 1);
return calendar.getTimeInMillis();
voiddecrementOneDay(Time t)
decrement One Day
if (t.monthDay > 1) {
    t.monthDay--;
    return;
if (t.month > 0) {
    t.month--;
} else {
    t.year--;
...
CalendarbeforeNDays(Calendar c, int n)
before N Days
long offset = n * 24 * 60 * 60 * 1000;
Calendar calendar = null;
if (c != null) {
    calendar = c;
} else {
    calendar = Calendar.getInstance();
calendar.setTimeInMillis(calendar.getTimeInMillis() - offset);
...
DateaddDays(Date date, int days)
Add days to an existent date
Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.add(Calendar.DATE, days); 
return cal.getTime();