Java Day Compare afterNDay(int n)

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

Description

after N Day

License

Open Source License

Declaration

public static String afterNDay(int n) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

import java.text.DateFormat;

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

public class Main {
    public static String afterNDay(int n) {
        Calendar c = Calendar.getInstance();
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
        c.setTime(new Date());
        c.add(Calendar.DATE, n);/*from ww w . java2  s.  c o m*/
        Date d2 = c.getTime();
        String s = df.format(d2);
        return s;
    }
}

Related

  1. afterNDaysDate(String theDate, int nDayNum, String format)
  2. compareDateByDay(Date date1, Date date2)
  3. compareDay(Date first, Date second)
  4. compareInSameDay(Date date1, Date date2)