Java Month getMonthLastDate(int month, int year)

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

Description

get Month Last Date

License

Apache License

Declaration

private static int getMonthLastDate(int month, int year) 

Method Source Code

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

public class Main {
    private static int getMonthLastDate(int month, int year) {
        int lastDay;
        switch (month) {
        case 0:/*w w  w . j  a v  a2  s. c om*/
        case 2:
        case 4:
        case 6:
        case 7:
        case 9:
        case 11:
            lastDay = 31;
            break;
        case 1:
            if (year % 4 == 0 && year % 100 == 0)
                lastDay = 29;
            else
                lastDay = 28;
            break;

        default:
            lastDay = 30;
            break;
        }
        return lastDay;
    }
}

Related

  1. getMonthDiff(String startDate, String endDate)
  2. getMonthEnd(String strdate)
  3. getMonthFromDate(String date)
  4. getMonthFromYM(String ym)
  5. getMonthInEnglish(int month)
  6. getMonthLength(final int year, final int month)
  7. getMonthLength(int year, int m)
  8. getMonthLength(int year, int month)
  9. getMonthMaxDate(String str)