Java Month Name Get getMonthFromMonthName(String name)

Here you can find the source of getMonthFromMonthName(String name)

Description

get Month From Month Name

License

Open Source License

Declaration

static public int getMonthFromMonthName(String name) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    private static String[] months = new String[] { "January", "February", "March", "April", "May", "June", "July",
            "August", "September", "October", "November", "December" };

    static public int getMonthFromMonthName(String name) {
        for (int i = 0; i < 12; i++) {
            if (months[i].equalsIgnoreCase(name)) {
                return i;
            }//from w  ww  .  j av  a2 s. c o m
        }
        return -1;
    }
}

Related

  1. createDaemonThread(Runnable runnable, String threadName)
  2. getDutchMonthName(int monthNumber)
  3. getMonth(boolean name)
  4. getMonth(String monthName)
  5. getMonthByName(String monthName)
  6. getMonthName()
  7. getMonthName(Date date)
  8. getMonthName(int index)
  9. getMonthName(int month, Locale locale)