Java Month getMonthMaxDate(String str)

Here you can find the source of getMonthMaxDate(String str)

Description

get Month Max Date

License

Apache License

Declaration

public static String getMonthMaxDate(String str) 

Method Source Code

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

public class Main {
    public static String getMonthMaxDate(String str) {

        int month = Integer.parseInt(str.substring(5));
        switch (month) {
        case 1:/* w ww . j av a 2 s  . c  om*/
        case 3:
        case 5:
        case 7:
        case 8:
        case 10:
        case 12:
            return "31";
        case 4:
        case 6:
        case 9:
        case 11:
            return "30";
        case 2:
            int year = Integer.parseInt(str.substring(0, 3));
            if ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0)
                return "29";
            else
                return "28";
        }
        return "0";

    }
}

Related

  1. getMonthInEnglish(int month)
  2. getMonthLastDate(int month, int year)
  3. getMonthLength(final int year, final int month)
  4. getMonthLength(int year, int m)
  5. getMonthLength(int year, int month)
  6. getMonthOfNextQuarter(String yearAndMonth)
  7. getMonthRange(String start, String end)
  8. getMonths()
  9. getMonths(String strDateBegin, String strDateEnd)