Java Day Add addDays(Date d, int n)

Here you can find the source of addDays(Date d, int n)

Description

add Days

License

Open Source License

Declaration

public static Date addDays(Date d, int n) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

import java.util.Date;
import java.util.GregorianCalendar;

public class Main {
    public static Date addDays(Date d, int n) {
        Calendar c = dateToCalendar(d);
        c.add(Calendar.DAY_OF_MONTH, n);
        return c.getTime();
    }/*from w  w w . jav  a 2 s.  co m*/

    public static Calendar dateToCalendar(Date d) {
        Calendar c1 = new GregorianCalendar();
        c1.setTime(d);
        return c1;
    }
}

Related

  1. addDays(Date aDate, int days)
  2. addDays(Date baseDate, int amount, boolean endOfDay)
  3. addDays(Date beginDate, int days)
  4. addDays(Date d, double count)
  5. addDays(Date d, int days)
  6. addDays(Date date, int amount)
  7. addDays(Date date, int count)
  8. addDays(Date date, int day)
  9. addDays(Date date, int days)