Java Date After getNDayAfterCurrentDate(int n)

Here you can find the source of getNDayAfterCurrentDate(int n)

Description

get N Day After Current Date

License

Open Source License

Declaration

public final static String getNDayAfterCurrentDate(int n) 

Method Source Code

//package com.java2s;

import java.util.Calendar;

public class Main {
    public final static String getNDayAfterCurrentDate(int n) {
        Calendar c = Calendar.getInstance();
        c.add(Calendar.DAY_OF_MONTH, n);
        return formatCalendarToyyyyMMdd(c);
    }// w  w w.  j  a  v a2s  .c o m

    public static String formatCalendarToyyyyMMdd(Calendar c) {
        return new StringBuffer().append(c.get(Calendar.YEAR)).append("-").append(c.get(Calendar.MONTH) + 1)
                .append("-").append(c.get(Calendar.DATE)).toString();
    }
}

Related

  1. getDateAfterAddition(Date date, int days)
  2. getDateAfterMonths(Date start, int months)
  3. getDateScopeAfterMonth(int year, int month)
  4. getDateTimeAfter(final Date _from, final int _time_type, final int _count)
  5. getMonthAfter(final Date _from, final int _mons)
  6. getSpecifiedDayAfter(Date date, int num)
  7. getSpecifiedDayAfter4Date(Date date)
  8. isAfter(Date d1, Date d2)
  9. isAfter(Date date1, Date date2)