Java Date to Month getMonthLastDay(Date date)

Here you can find the source of getMonthLastDay(Date date)

Description

get Month Last Day

License

Open Source License

Declaration

public static Date getMonthLastDay(Date date) 

Method Source Code

//package com.java2s;

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

public class Main {
    public static Date getMonthLastDay(Date date) {
        Calendar calendar = Calendar.getInstance();
        if (null != date) {
            calendar.setTime(date);/*from   w ww  . j  a  va2 s  .  c o m*/
        }
        calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DATE));
        calendar.set(Calendar.HOUR_OF_DAY, 23);
        calendar.set(Calendar.MINUTE, 59);
        calendar.set(Calendar.SECOND, 59);
        calendar.set(Calendar.MILLISECOND, 999);
        return calendar.getTime();
    }
}

Related

  1. getMonthDays(String date)
  2. getMonthFirstDay(Date date)
  3. getMonthFromDate(Date date)
  4. getMonthInterval(Date _one, Date _two)
  5. getMonthLastDate(Date date)
  6. getMonthlyKey(Date d)
  7. getMonthName(Date date)
  8. getMonthOfCurrentTime(Date date)
  9. getMonthOffset(Date sourceDate, Date targetDate)