Java Date Add dateAdd(Date date, int val)

Here you can find the source of dateAdd(Date date, int val)

Description

date Add

License

Apache License

Declaration

public static Date dateAdd(Date date, int val) 

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 dateAdd(Date date, int val) {
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);//from   www  . j  a  va  2 s  .  c  o m
        calendar.add(Calendar.DAY_OF_MONTH, val);
        date = calendar.getTime();
        return date;
    }
}

Related

  1. addSeconds(Date date1, long secs)
  2. dateAdd(Date date, int days)
  3. dateAdd(Date date, int days)
  4. dateAdd(Date date, int field, int amount)
  5. dateAdd(Date date, int type, int num)
  6. dateAdd(final Date baseDateTime, int daysToAdd, boolean chopTime)
  7. dateAdd(int datePart, int amount, Date date)
  8. dateAdd(int interval, Date date, int n)
  9. DateAdd(String strDate, int iCount, int iType)