Java Month Get getNearbyMonth(String month, int i)

Here you can find the source of getNearbyMonth(String month, int i)

Description

get Nearby Month

License

Open Source License

Declaration

public static String getNearbyMonth(String month, int i) throws ParseException 

Method Source Code


//package com.java2s;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class Main {

    public static String getNearbyMonth(String month, int i) throws ParseException {
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMM");
        Date mydate = formatter.parse(month);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(mydate);//from   w  w  w.j a  v a2 s  .  com
        calendar.add(Calendar.MONTH, i);
        return formatter.format(calendar.getTime());

    }
}

Related

  1. getMonthStartTime(int year, int month)
  2. getMonthString(Date date)
  3. getMonthString(int month)
  4. getMonthStringFromNumber(String monthNumber)
  5. getMonthStrings()
  6. getReportMonthString()
  7. getSelectMonth(String month)
  8. getShortMonthForInt(final Locale locale, int theMonth)
  9. getSpecficMonthStart(Date date, int amount)