Java Date Add addDays(Date when, int amount)

Here you can find the source of addDays(Date when, int amount)

Description

add Days

License

Open Source License

Declaration

public static Date addDays(Date when, int amount) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.util.*;

public class Main {

    public static Date addDays(Date when, int amount) {
        return add(when, Calendar.DAY_OF_YEAR, amount);
    }/*  w  ww.ja  v  a  2 s.  c o m*/

    public static Date add(Date when, int field, int amount) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(when);
        calendar.add(field, amount);
        return calendar.getTime();
    }
}

Related

  1. addDates(Date startDate, int days)
  2. addDay(Date date, int days)
  3. addDays(Date date1, long days)
  4. addDays(Date dateToAdd, int numberOfDay)
  5. addDays(Date target, int days)
  6. addDays(int count, Calendar timestamp)
  7. addDaysToCurrentDate(Integer dayIncrement)
  8. addInteger(Date date, int dateType, int amount)
  9. addSeconds(Date date1, long secs)