Java Month Convert monthConvertToNumber(String str)

Here you can find the source of monthConvertToNumber(String str)

Description

month Convert To Number

License

Open Source License

Declaration

public static int monthConvertToNumber(String str) 

Method Source Code

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

public class Main {
    public static int monthConvertToNumber(String str) {
        switch (str) {
        case "Jan":
            return 1;
        case "Feb":
            return 2;
        case "Mar":
            return 3;
        case "Apr":
            return 4;
        case "May":
            return 5;
        case "Jun":
            return 6;
        case "Jul":
            return 7;
        case "Aug":
            return 8;
        case "Sep":
            return 9;
        case "Oct":
            return 10;
        case "Nov":
            return 11;
        case "Dec":
            return 12;
        default://from ww  w .  j  a v a2s .c  o m
            return -1;
        }
    }
}

Related

  1. isCurMonth(String month)
  2. month()
  3. month(Date date, Locale locale)
  4. month2String(Date date)
  5. monthAgo()
  6. monthformMatDate(Date date)
  7. monthIndexAsString(Integer index, Integer offset)
  8. monthNumber(String s)
  9. monthOfDate(Date s)