Java Utililty Methods Month Convert

List of utility methods to do Month Convert

Description

The list of methods to do Month Convert are organized into topic(s).

Method

StringconvertCharMonthToDecimal(String month)
convert Char Month To Decimal
if (month.toLowerCase().indexOf("jan") != -1)
    return "01";
else if (month.toLowerCase().indexOf("feb") != -1)
    return "02";
else if (month.toLowerCase().indexOf("mar") != -1)
    return "03";
else if (month.toLowerCase().indexOf("apr") != -1)
    return "04";
...
StringconvertDecimalToCharMonth(int month)
convert Decimal To Char Month
if (month == 1)
    return "Jan";
else if (month == 2)
    return "Feb";
else if (month == 3)
    return "Mar";
else if (month == 4)
    return "Apr";
...
StringconvertMonth(String monthSlashYear)

01/2012 to January 2012

String[] monthYear = monthSlashYear.split("/");
String month = monthYear[0];
String year = monthYear[1];
return getEnMonth(month) + " " + year;
intconvertMonth(String value)
convert Month
value = value.trim();
return Integer.parseInt(value);
StringconvertMonthFromNumber(int month)
convert Month From Number
if (month < 1) {
    return "01";
} else if (month >= 1 && month <= 9) {
    return "0" + month;
} else if (month >= 10 && month <= 12) {
    return "" + month;
} else {
    return "12";
...
StringconvertMonthStringToInt(String monthString)
convert Month String To Int
if (monthString.toLowerCase().equals("jan")) {
    return "01";
} else if (monthString.toLowerCase().equals("feb") || monthString.toLowerCase().equals("fev")) {
    return "02";
} else if (monthString.toLowerCase().equals("mar")) {
    return "03";
} else if (monthString.toLowerCase().equals("apr")) {
    return "04";
...
StringConvertNumToMonth(int mesEntrada)
Convert Num To Month
String mesSalida = "";
switch (mesEntrada) {
case 1:
    mesSalida = "Enero";
    break;
case 2:
    mesSalida = "Febrero";
    break;
...
StringconvertToAlphaMonth(final int importIntMonth)
Convert a numeric month into an alphabet month.
String importStrMonth = null;
switch (importIntMonth) {
case 1:
    importStrMonth = "January";
    break;
case 2:
    importStrMonth = "February";
    break;
...
StringconvertToMonth_long(int month)
convert To Montlong
switch (month) {
case 1:
    return "January";
case 2:
    return "February";
case 3:
    return "March";
case 4:
...
intconvertToNumericMonth(String importStrMonth)
Convert an alphabet month into a numeric month.
importStrMonth = safeString(importStrMonth);
if (importStrMonth.equals("January")) {
    return 1;
} else if (importStrMonth.equals("February")) {
    return 2;
} else if (importStrMonth.equals("March")) {
    return 3;
} else if (importStrMonth.equals("April")) {
...