Java Day of getAfterDays(String date, String pattern, int afterDays)

Here you can find the source of getAfterDays(String date, String pattern, int afterDays)

Description

get After Days

License

Apache License

Declaration

public static List<String> getAfterDays(String date, String pattern, int afterDays) throws Exception 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.SimpleDateFormat;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.GregorianCalendar;
import java.util.List;

public class Main {
    public static List<String> getAfterDays(String date, String pattern, int afterDays) throws Exception {
        List<String> list = new ArrayList<String>();
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        Date getDate = sdf.parse(date);
        GregorianCalendar gc = new GregorianCalendar();
        gc.setTime(getDate);/*from www  .  java 2 s  .  co  m*/
        for (int i = 0; i < afterDays; i++) {
            gc.add(Calendar.DATE, 1);
            getDate = gc.getTime();
            list.add(sdf.format(getDate));
        }
        return list;
    }
}

Related

  1. formatDay(final Date time)
  2. formatDayTime(String day)
  3. formatShortNameOfDay(final Date date)
  4. get1DayBeforDate()
  5. get8BitTime(Date date, int deltaDay)
  6. getAge(Date birthDay)
  7. getAgeOfCalendar(String birthDayString)
  8. getApisPaxBirthday(String dob)
  9. getBeforeDate(int day)