Android Day Add addDayOfMonth(Date date, int difference)

Here you can find the source of addDayOfMonth(Date date, int difference)

Description

add Day Of Month

License

Open Source License

Declaration

public static Date addDayOfMonth(Date date, int difference) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {
    public static Date addDayOfMonth(Date date) {
        Calendar calendar = calendarDate(date);
        calendar.add(Calendar.DAY_OF_MONTH, 1);
        return calendar.getTime();
    }// w  w w .  j a v a2 s.com

    public static Date addDayOfMonth(Date date, int difference) {
        Calendar calendar = calendarDate(date);
        calendar.add(Calendar.DAY_OF_MONTH, difference);
        return calendar.getTime();
    }

    public static Calendar calendarDate(Date date) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar;
    }
}

Related

  1. addDayOfMonth(Date date)
  2. addDay(long dateTimeMillis)
  3. addDay(long dateTimeMillis)
  4. decrementOneDay(Time t)
  5. beforeNDays(Calendar c, int n)