Java Month Convert convertMonth(String monthSlashYear)

Here you can find the source of convertMonth(String monthSlashYear)

Description

01/2012 to January 2012

License

Open Source License

Parameter

Parameter Description
monthSlashYear a parameter

Declaration

public static final String convertMonth(String monthSlashYear) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from   w w w  . j  av  a 2 s .c o m
     * <p>01/2012 to January 2012</p>
     * 
     * @param monthSlashYear
     * @return
     */
    public static final String convertMonth(String monthSlashYear) {
        String[] monthYear = monthSlashYear.split("/");
        String month = monthYear[0];
        String year = monthYear[1];
        return getEnMonth(month) + " " + year;
    }

    public static final String getEnMonth(String month) {
        if (month.equals("01") || month.equals("1")) {
            month = "January";
        } else if (month.equals("02") || month.equals("2")) {
            month = "Feburary";
        } else if (month.equals("03") || month.equals("3")) {
            month = "March";
        } else if (month.equals("04") || month.equals("4")) {
            month = "April";
        } else if (month.equals("05") || month.equals("5")) {
            month = "May";
        } else if (month.equals("06") || month.equals("6")) {
            month = "June";
        } else if (month.equals("07") || month.equals("7")) {
            month = "July";
        } else if (month.equals("08") || month.equals("8")) {
            month = "August";
        } else if (month.equals("09") || month.equals("9")) {
            month = "September";
        } else if (month.equals("10")) {
            month = "October";
        } else if (month.equals("11")) {
            month = "November";
        } else if (month.equals("12")) {
            month = "December";
        }
        return month;
    }
}

Related

  1. convertCharMonthToDecimal(String month)
  2. convertDecimalToCharMonth(int month)
  3. convertMonth(String value)
  4. convertMonthFromNumber(int month)
  5. convertMonthStringToInt(String monthString)
  6. ConvertNumToMonth(int mesEntrada)