Java Day Add addDays(int days)

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

Description

add Days

License

Open Source License

Declaration

public static String addDays(int days) 

Method Source Code

//package com.java2s;
/*//from   w ww .  j  a  v a2 s .  c o  m
 * Copyright 2010 Mttang.com All right reserved. This software is the
 * confidential and proprietary information of Mttang.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Mttang.com.
 */

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

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

    public static String addDays(int days) {
        GregorianCalendar cal = new GregorianCalendar();
        cal.setTime(new Date());
        cal.add(Calendar.DATE, days);
        return yyyyMMdd.format(cal.getTime());
    }
}

Related

  1. addDays(Date startDate, int numDays)
  2. addDays(Date when, int amount)
  3. addDays(final Date date, final int addDays)
  4. addDays(final Date date, final int days)
  5. addDays(final Date date, final int days)
  6. addDays(int days, Date date)
  7. addDays(Integer dateAsInt, Integer daysToAdd)
  8. addDays(java.util.Date value, final int days)
  9. AddDays(long initialDateMilliSeconds, int dayNumber)