Java Month Calculate intToCalendarMonth(int month)

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

Description

int To Calendar Month

License

Open Source License

Declaration

private static int intToCalendarMonth(int month) 

Method Source Code


//package com.java2s;
/*/*from   w w w  .  java2 s.  c  om*/
 * Copyright 2007 Sun Microsystems, Inc.
 * All rights reserved.  You may not modify, use,
 * reproduce, or distribute this software except in
 * compliance with  the terms of the License at:
 * http://developer.sun.com/berkeley_license.html
 */

import java.util.*;

public class Main {
    private static int intToCalendarMonth(int month) {
        if (month == 1) {
            return Calendar.JANUARY;
        } else if (month == 2) {
            return Calendar.FEBRUARY;
        } else if (month == 3) {
            return Calendar.MARCH;
        } else if (month == 4) {
            return Calendar.APRIL;
        } else if (month == 5) {
            return Calendar.MAY;
        } else if (month == 6) {
            return Calendar.JUNE;
        } else if (month == 7) {
            return Calendar.JULY;
        } else if (month == 8) {
            return Calendar.AUGUST;
        } else if (month == 9) {
            return Calendar.SEPTEMBER;
        } else if (month == 10) {
            return Calendar.OCTOBER;
        } else if (month == 11) {
            return Calendar.NOVEMBER;
        } else if (month == 12) {
            return Calendar.DECEMBER;
        } else {
            return Calendar.JANUARY;
        }
    }
}

Related

  1. getNowMonth()
  2. getStartOfMonth(Calendar scal)
  3. getThisMonthEnd()
  4. getThisMonthStart()
  5. incrementMonth(long date, int increment)
  6. isFirstOfMonth(long date)
  7. isMonthEnd(Date date)
  8. isSameMonth(final Calendar c1, final Calendar c2)
  9. monthsBetween(String pFormerStr, String pLatterStr)