Java Month getMonthOfNextQuarter(String yearAndMonth)

Here you can find the source of getMonthOfNextQuarter(String yearAndMonth)

Description

get Month Of Next Quarter

License

Open Source License

Declaration

public static String getMonthOfNextQuarter(String yearAndMonth) 

Method Source Code

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

public class Main {

    public static String getMonthOfNextQuarter(String yearAndMonth) {
        int year = Integer.parseInt(yearAndMonth.substring(0, 4));
        int mon = Integer.parseInt(yearAndMonth.substring(4, 6));
        String nextmonth = "";
        String nextyear = String.valueOf(year);
        if (mon == 10) {
            nextmonth = "01";
            nextyear = String.valueOf(year + 1);
        } else if (mon == 11) {
            nextmonth = "02";
            nextyear = String.valueOf(year + 1);
        } else if (mon == 12) {
            nextmonth = "03";
            nextyear = String.valueOf(year + 1);
        } else if (mon < 7) {
            nextmonth = "0" + String.valueOf(mon + 3);
        } else {//from  ww  w  .  ja  va  2  s  .c  o m
            nextmonth = String.valueOf(mon + 3);
        }
        return nextyear + nextmonth;
    }
}

Related

  1. getMonthLastDate(int month, int year)
  2. getMonthLength(final int year, final int month)
  3. getMonthLength(int year, int m)
  4. getMonthLength(int year, int month)
  5. getMonthMaxDate(String str)
  6. getMonthRange(String start, String end)
  7. getMonths()
  8. getMonths(String strDateBegin, String strDateEnd)
  9. getMonthTime(String allDate)