Android Day Add addDays(Date date, int days)

Here you can find the source of addDays(Date date, int days)

Description

Add days to an existent date

Parameter

Parameter Description
date a parameter
days a parameter

Declaration

public static Date addDays(Date date, int days) 

Method Source Code

//package com.java2s;

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

public class Main {
    /**/*  w w  w.  ja va 2  s  . c  om*/
     * Add days to an existent date
     * @param date
     * @param days
     * @return
     */
    public static Date addDays(Date date, int days) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.DATE, days); //minus number would decrement the days
        return cal.getTime();
    }
}

Related

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