Java Month of Year getNextYearMonth(String yearMonth)

Here you can find the source of getNextYearMonth(String yearMonth)

Description

get Next Year Month

License

Open Source License

Declaration

public static String getNextYearMonth(String yearMonth) 

Method Source Code


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

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

public class Main {
    private static final String year_month_pattern = "yyyy-MM";

    public static String getNextYearMonth(String yearMonth) {
        SimpleDateFormat format = new SimpleDateFormat(year_month_pattern);
        Calendar calendar = Calendar.getInstance();
        try {/*from w  w w . j a v  a 2 s .  com*/
            calendar.setTime(format.parse(yearMonth));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        calendar.add(Calendar.MONTH, 1);
        return format.format(calendar.getTime());
    }
}

Related

  1. getNextMonth(Calendar aCal)
  2. getNextMonth(Date nowdate, int delay)
  3. getNextMonthFirstDay(String date)
  4. getNextMonthFirstDay(T day)
  5. getNextMonthFistDay(String nowdate, String inFormat, String outFormat)
  6. getNrDaysOfMonth(int month, int year)
  7. getNumberOfDays(int year, int month)
  8. getOntologyURIBase(String defaultBase, boolean appendYear, boolean appendMonth, boolean appendDay)
  9. getPreviousDateStringByMonth(int months)