Java Date Add addDateByDays(int days)

Here you can find the source of addDateByDays(int days)

Description

add Date By Days

License

Apache License

Declaration

public static Date addDateByDays(int days) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

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

public class Main {

    public static Date addDateByDays(int days) {
        return addDateByDays(getCurrentDate(), days);
    }//from   w  w  w. j  a va 2s. c o m

    public static Date addDateByDays(Date source, int days) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(source);
        calendar.add(Calendar.DATE, days);
        return calendar.getTime();
    }

    public static Date getCurrentDate() {
        return new Date();
    }
}

Related

  1. addDate(String date)
  2. addDate(String date, int amount)
  3. addDate(String date, String type, int into)
  4. addDate(String date1, String addpart, int num)
  5. addDate(String dt, long day)
  6. addDateDay(int day)
  7. addDateParam(String dtstr, boolean start, List where)
  8. addDates(Date startDate, int days)
  9. addDay(Date date, int days)