Java Day in Month getMaxMonthDay(int year, int month)

Here you can find the source of getMaxMonthDay(int year, int month)

Description

get Max Month Day

License

Apache License

Declaration

public static int getMaxMonthDay(int year, int month) 

Method Source Code

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

public class Main {
    public static int getMaxMonthDay(int year, int month) {
        if (month < 7) {
            return 31; // months 1..6
        }/* ww  w  . j a  v  a  2s. c  om*/
        if (month < 12) {
            return 30; // months 7..11
        }
        if (isJalaliLeapYear(year)) {
            return 30; // month 12, but leap year
        }
        return 29; // month 12 and not a leap year
    }

    public static boolean isJalaliLeapYear(int year) {
        int mod = (year + 11) % 33;
        if ((mod != 32) && ((mod % 4) == 0)) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. getFirstdayOfMonth(String year, String month)
  2. getLastDayInMonth(int month, int year)
  3. getLastDayOfMonth(int year, int month)
  4. getLastDayOfMonth(String monthInitials)
  5. getMaxDayByMonth(String month)
  6. getMonthDay(int year, int month)
  7. getMonthDayFormats()
  8. getMonthDays(int year, int month)
  9. getMonthDaysArray(int year)