Java Month Day getMonthMaxDay(String sDate)

Here you can find the source of getMonthMaxDay(String sDate)

Description

get Month Max Day

License

Apache License

Declaration

private static String getMonthMaxDay(String sDate) 

Method Source Code


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

import java.text.SimpleDateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.*;

public class Main {

    private static String getMonthMaxDay(String sDate) {
        SimpleDateFormat sdf_full = new SimpleDateFormat("yyyy-MM-dd");
        Calendar cal = Calendar.getInstance();
        Date date = null;/*from  w  w w  .j  a  v a  2s .c o  m*/
        try {
            date = sdf_full.parse(sDate + "-01");
        } catch (ParseException e) {
            e.printStackTrace();
        }
        cal.setTime(date);
        int last = cal.getActualMaximum(Calendar.DATE);
        return String.valueOf(last);
    }
}

Related

  1. getMonthLastDay()
  2. getMonthLastDay()
  3. getMonthLastDay(String curmonth, int month)
  4. getMonthLastDay(String dateString)
  5. getMonthLastDay(String fmt)
  6. getMonthWeek(String curday)
  7. getMonthWeek(String curday)
  8. getPreviosMonthFirstDay()
  9. getShortFirstDayOfMonth()