Java Date Add DateAddDays(Date _date, int days)

Here you can find the source of DateAddDays(Date _date, int days)

Description

Date Add Days

License

Apache License

Declaration

public static String DateAddDays(Date _date, int days) 

Method Source Code

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

import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {
    private static final SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");

    public static String DateAddDays(Date _date, int days) {
        Calendar cl = Calendar.getInstance();
        cl.setTime(_date);//w w w.  j ava 2 s .c o m
        cl.add(Calendar.DAY_OF_YEAR, days);
        _date = cl.getTime();
        return simpleDateFormat.format(_date);
    }
}

Related

  1. dateAdd(int datePart, int amount, Date date)
  2. dateAdd(int interval, Date date, int n)
  3. DateAdd(String strDate, int iCount, int iType)
  4. DateAdd3Days(String _date)
  5. dateAddDay(Date date, int day)
  6. dateAddDays(Date date, int days)
  7. dateAddDays(Date date, int days)
  8. dateAddDays(Date time, int days, String dateFormat)
  9. dateAddHours(Date time, int hours, SimpleDateFormat dateFormat)