Java Year Month lastDay(int year, int month)

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

Description

last Day

License

Open Source License

Declaration

private static int lastDay(int year, int month) throws java.text.ParseException 

Method Source Code

//package com.java2s;

public class Main {
    private static int lastDay(int year, int month) throws java.text.ParseException {
        int day = 0;
        switch (month) {
        case 1://  ww  w.j ava  2s. co m
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            day = 31;
            break;
        case 2:
            if ((year % 4) == 0) {
                if ((year % 100) == 0 && (year % 400) != 0) {
                    day = 28;
                } else {
                    day = 29;
                }
            } else {
                day = 28;
            }
            break;
        default:
            day = 30;
        }
        return day;
    }
}

Related

  1. getYearMonthDay(final int year, final int month, final int day)
  2. getYearMonthList(int year)
  3. getYearMonths(List time)
  4. getYearMonthStr(Date parseDate)
  5. getYearMonthString(Date date)
  6. makeDate(int day, int month, int year, int hour, int min, int sec)
  7. monthBeginDate(int year, int month)
  8. newDate(int year, int month, int day)
  9. normalizeShortDate(String year, String month, String day)