Java Month Name Get getMonthStr(String str)

Here you can find the source of getMonthStr(String str)

Description

get Month Str

License

Apache License

Declaration

public static String getMonthStr(String str) 

Method Source Code

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

public class Main {
    public static String getMonthStr(String str) {
        String[] monthOfYear = { "JAN", "FEB", "MAR", "APR", "MAY", "JUN", "JUL", "AUG", "SEP", "OCT", "NOV",
                "DEC" };
        if ("01".equals(str)) {
            str = monthOfYear[0];//ww w.  jav a  2  s. c  o  m
        } else if ("02".equals(str)) {
            str = monthOfYear[1];
        } else if ("03".equals(str)) {
            str = monthOfYear[2];
        } else if ("04".equals(str)) {
            str = monthOfYear[3];
        } else if ("05".equals(str)) {
            str = monthOfYear[4];
        } else if ("06".equals(str)) {
            str = monthOfYear[5];
        } else if ("07".equals(str)) {
            str = monthOfYear[6];
        } else if ("08".equals(str)) {
            str = monthOfYear[7];
        } else if ("09".equals(str)) {
            str = monthOfYear[8];
        } else if ("10".equals(str)) {
            str = monthOfYear[9];
        } else if ("11".equals(str)) {
            str = monthOfYear[10];
        } else if ("12".equals(str)) {
            str = monthOfYear[11];
        } else {
            str = "ERROR";
        }
        return str;
    }
}

Related

  1. getMonthNames(Locale locale)
  2. getMonthNames(Locale locale)
  3. getMonthSelect(String selectName, String value, boolean hasBlank)
  4. getMonthStr(int month)
  5. getMonthStr(int month)
  6. getMonthString(int month)
  7. getPreMonthText(String pattern)
  8. month(String monthName)
  9. monthCalValue(String monthName)