Java Month Name Get monthCalValue(String monthName)

Here you can find the source of monthCalValue(String monthName)

Description

month Cal Value

License

Apache License

Declaration

public static int monthCalValue(String monthName) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    public static int monthCalValue(String monthName) {
        if (monthName.compareToIgnoreCase("Jan") == 0 || monthName.compareToIgnoreCase("January") == 0)
            return Calendar.JANUARY;
        if (monthName.compareToIgnoreCase("Feb") == 0 || monthName.compareToIgnoreCase("February") == 0)
            return Calendar.FEBRUARY;
        if (monthName.compareToIgnoreCase("Mar") == 0 || monthName.compareToIgnoreCase("March") == 0)
            return Calendar.MARCH;
        if (monthName.compareToIgnoreCase("Apr") == 0 || monthName.compareToIgnoreCase("April") == 0)
            return Calendar.APRIL;
        if (monthName.compareToIgnoreCase("May") == 0 || monthName.compareToIgnoreCase("May") == 0)
            return Calendar.MAY;
        if (monthName.compareToIgnoreCase("Jun") == 0 || monthName.compareToIgnoreCase("June") == 0)
            return Calendar.JUNE;
        if (monthName.compareToIgnoreCase("Jul") == 0 || monthName.compareToIgnoreCase("July") == 0)
            return Calendar.JULY;
        if (monthName.compareToIgnoreCase("Aug") == 0 || monthName.compareToIgnoreCase("August") == 0)
            return Calendar.AUGUST;
        if (monthName.compareToIgnoreCase("Sep") == 0 || monthName.compareToIgnoreCase("September") == 0)
            return Calendar.SEPTEMBER;
        if (monthName.compareToIgnoreCase("Oct") == 0 || monthName.compareToIgnoreCase("October") == 0)
            return Calendar.OCTOBER;
        if (monthName.compareToIgnoreCase("Nov") == 0 || monthName.compareToIgnoreCase("November") == 0)
            return Calendar.NOVEMBER;
        if (monthName.compareToIgnoreCase("Dec") == 0 || monthName.compareToIgnoreCase("December") == 0)
            return Calendar.DECEMBER;

        return Calendar.UNDECIMBER;
    }//from  w  ww .  j  a  v a  2s  .  c  o  m
}

Related

  1. getMonthStr(int month)
  2. getMonthStr(String str)
  3. getMonthString(int month)
  4. getPreMonthText(String pattern)
  5. month(String monthName)
  6. monthName(int month)
  7. monthName(int n)
  8. monthNameAbbrev(int mon)
  9. toMonthNameAbreviated(int m)