Java Month getNextMonth(String curYearMonth)

Here you can find the source of getNextMonth(String curYearMonth)

Description

get Next Month

License

Open Source License

Declaration

public static String getNextMonth(String curYearMonth) 

Method Source Code

//package com.java2s;

public class Main {

    public static String getNextMonth(String curYearMonth) {
        int year = Integer.parseInt(curYearMonth.substring(0, 4));
        int month = Integer.parseInt(curYearMonth.substring(4));
        if (month == 12) {
            year += 1;//from ww  w.  j a v a2  s .  c  om
            month = 1;
        } else {
            month += 1;
        }

        StringBuffer strb = new StringBuffer().append(year);
        if (month > 9)
            strb.append(month);
        else
            strb.append("0").append(month);
        return strb.toString();
    }
}

Related

  1. getMonths()
  2. getMonths(String strDateBegin, String strDateEnd)
  3. getMonthTime(String allDate)
  4. getMonthToMonth(int month)
  5. getMonthTotal(Double bsAmount, Double susAmount, Double changeRate)
  6. getNextMonth(String month)
  7. getNextMonthSpe(String curYearMonth)
  8. getPreMonth(String thisMonth)
  9. getQuarterLastMonth(String quarter)