Java Day in Month is31DaysMonth(int month)

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

Description

Verify if a given month has 31 days or not.

License

Open Source License

Parameter

Parameter Description
month Month.

Return

Has 31 days or not.

Declaration

public static final boolean is31DaysMonth(int month) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w  w w. j ava 2  s . co  m
     * <p>
     * Verify if a given month has 31 days or not.
     * </p>
     * @param month Month.
     * @return Has 31 days or not.
     */
    public static final boolean is31DaysMonth(int month) {
        int[] months31 = { 0, 2, 4, 6, 7, 9, 11 };
        //
        for (int i = months31.length - 1; i >= 0; i--) {
            if (months31[i] == month) {
                return true;
            }
        }
        //
        return false;
    }
}

Related

  1. getNumberOfDaysInMonth(Integer year, Integer month)
  2. getNumberOfDaysInMonthes(int theyear)
  3. getNumDaysInMonth(String monthID, String yearID)
  4. getPreMonthDayStr(String curday)
  5. getStartMonthDayOfDate(String yyyyMM)
  6. isDayMonth(String types)
  7. isDayOfMonth(int num)
  8. isLastDayOfMonth(int day, int month, int year)
  9. maxDayOfMonth(int year, int month)