Java Month Number Get getNumByStrMonth(String strMonth)

Here you can find the source of getNumByStrMonth(String strMonth)

Description

get Num By Str Month

License

Apache License

Declaration

public static int getNumByStrMonth(String strMonth) 

Method Source Code

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

public class Main {
    public static int getNumByStrMonth(String strMonth) {
        if (strMonth.equals("January")) {
            return 1;
        }/*from   w  w  w .  j av a  2 s  .co m*/
        if (strMonth.equals("February")) {
            return 2;
        }
        if (strMonth.equals("March")) {
            return 3;
        }
        if (strMonth.equals("April")) {
            return 4;
        }
        if (strMonth.equals("May")) {
            return 5;
        }
        if (strMonth.equals("June")) {
            return 6;
        }
        if (strMonth.equals("July")) {
            return 7;
        }
        if (strMonth.equals("August")) {
            return 8;
        }
        if (strMonth.equals("September")) {
            return 9;
        }
        if (strMonth.equals("October")) {
            return 10;
        }
        if (strMonth.equals("November")) {
            return 11;
        }
        if (strMonth.equals("December")) {
            return 12;
        }
        return 0;
    }
}

Related

  1. getMonthIndexAsString(String type)
  2. getMonthNumberByMonthInitials(String monthInitials)
  3. getMonthNumberString(int month)
  4. getMonthNumberString(String sMonth)
  5. getNumberOfRSLILMonth(String month)
  6. getNumericMonthEquivalent(String s)
  7. monthAdhToNumber(final String month)
  8. monthNumber(int month)