Java Calendar Month calendarMonthToInt(int calendarMonth)

Here you can find the source of calendarMonthToInt(int calendarMonth)

Description

calendar Month To Int

License

Open Source License

Declaration

private static int calendarMonthToInt(int calendarMonth) 

Method Source Code


//package com.java2s;

import java.util.Calendar;

public class Main {
    private static int calendarMonthToInt(int calendarMonth) {
        if (calendarMonth == Calendar.JANUARY) {
            return 1;
        } else if (calendarMonth == Calendar.FEBRUARY) {
            return 2;
        } else if (calendarMonth == Calendar.MARCH) {
            return 3;
        } else if (calendarMonth == Calendar.APRIL) {
            return 4;
        } else if (calendarMonth == Calendar.MAY) {
            return 5;
        } else if (calendarMonth == Calendar.JUNE) {
            return 6;
        } else if (calendarMonth == Calendar.JULY) {
            return 7;
        } else if (calendarMonth == Calendar.AUGUST) {
            return 8;
        } else if (calendarMonth == Calendar.SEPTEMBER) {
            return 9;
        } else if (calendarMonth == Calendar.OCTOBER) {
            return 10;
        } else if (calendarMonth == Calendar.NOVEMBER) {
            return 11;
        } else if (calendarMonth == Calendar.DECEMBER) {
            return 12;
        } else {//from ww w  .j  a v a2 s  . c  o m
            return 1;
        }
    }
}

Related

  1. calToLastDayOfMonth(Calendar c)
  2. convertRemoveAfterMonth(Calendar cal)
  3. endOfMonth(Calendar calendar)
  4. floorDayOfMonth(Calendar cal)