Java Month isMonthInRange(int month)

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

Description

Test to see if an integer is in the range of integers that can be months of the year.

License

Apache License

Parameter

Parameter Description
month the value to test

Return

true if month is in the range 1 to 12 inclusive, false otherwise.

Declaration

public static boolean isMonthInRange(int month) 

Method Source Code

//package com.java2s;
/** DateUtils.java// ww w  .  j av  a  2 s  .co  m
 * 
 * Copyright 2015-2017 President and Fellows of Harvard College
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

public class Main {
    /**
     * Test to see if an integer is in the range of integers that can be months of the year.
     * 
     * @param month the value to test
     * @return true if month is in the range 1 to 12 inclusive, false otherwise.
     */
    public static boolean isMonthInRange(int month) {
        boolean result = false;
        if (month > 0 && month < 13) {
            result = true;
        }
        return result;
    }
}

Related

  1. getTargetMonth(Integer targetYm)
  2. getTotalMonths(long time)
  3. getYMonth(String dateFromDB)
  4. impleMonth(int month)
  5. intToMonth(int m)
  6. isNumMonth(int m)
  7. isQuarterMonth(String[] types)
  8. isSameMonth(String preMonth, String month)
  9. issueMonth(int issue1, int issue2)