Java Day of Month getLastDayOfMonth(Date sDate)

Here you can find the source of getLastDayOfMonth(Date sDate)

Description

get Last Day Of Month

License

Open Source License

Declaration

@SuppressWarnings("deprecation")
public static Date getLastDayOfMonth(Date sDate) 

Method Source Code

//package com.java2s;

import java.util.Calendar;
import java.util.Date;

public class Main {

    @SuppressWarnings("deprecation")
    public static Date getLastDayOfMonth(Date sDate) {
        Calendar cDay = Calendar.getInstance();
        cDay.setTime(sDate);/*w  ww.j  a  v  a2s.co m*/
        int lastDay = cDay.getActualMaximum(Calendar.DAY_OF_MONTH);
        Date lastDate = cDay.getTime();
        lastDate.setDate(lastDay);
        lastDate.setHours(23);
        lastDate.setMinutes(59);
        lastDate.setSeconds(59);
        return lastDate;
    }
}

Related

  1. getLastDayOfMonth(Date date)
  2. getLastDayOfMonth(Date date)
  3. getLastDayOfMonth(Date dt)
  4. getLastDayOfMonth(Date firstDate)
  5. getLastDayOfMonth(Date now)
  6. getLastDayOfMonth(final Date date)
  7. getLastdayOfMonth(int month, int year)
  8. getLastDayOfMonth(int year, int month)
  9. getLastDayOfMonth(int year, int month)