Java Month Number Get monthNumber(int month)

Here you can find the source of monthNumber(int month)

Description

month Number

License

BSD License

Declaration

public static int monthNumber(int month) 

Method Source Code


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

import java.util.Calendar;

public class Main {
    public static int monthNumber(int month) {
        switch (month) {
        case 1://  w w  w .jav  a 2s. com
            return Calendar.JANUARY;
        case 2:
            return Calendar.FEBRUARY;
        case 3:
            return Calendar.MARCH;
        case 4:
            return Calendar.APRIL;
        case 5:
            return Calendar.MAY;
        case 6:
            return Calendar.JUNE;
        case 7:
            return Calendar.JULY;
        case 8:
            return Calendar.AUGUST;
        case 9:
            return Calendar.SEPTEMBER;
        case 10:
            return Calendar.OCTOBER;
        case 11:
            return Calendar.NOVEMBER;
        case 12:
            return Calendar.DECEMBER;
        default:
            return -1;
        }
    }
}

Related

  1. getMonthNumberString(String sMonth)
  2. getNumberOfRSLILMonth(String month)
  3. getNumByStrMonth(String strMonth)
  4. getNumericMonthEquivalent(String s)
  5. monthAdhToNumber(final String month)