Java Day End getMonthEndDate(Date date)

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

Description

get Month End Date

License

Apache License

Declaration

public static Date getMonthEndDate(Date date) 

Method Source Code

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

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

public class Main {

    public static Date getMonthEndDate(Date date) {
        GregorianCalendar c = new GregorianCalendar();
        c.setTime(date);/*from w w w  .  j  a  v  a  2 s.  c  o m*/
        int maxMonth = c.getActualMaximum(Calendar.DAY_OF_MONTH);
        c.set(Calendar.DAY_OF_MONTH, maxMonth);
        c.set(Calendar.HOUR_OF_DAY, 23);
        c.set(Calendar.MINUTE, 59);
        c.set(Calendar.SECOND, 59);
        return c.getTime();
    }
}

Related

  1. getMondays(Date startDate, Date endDate)
  2. getMonthBetween(Date startDate, Date endDate)
  3. getMonthCha(Date start, Date end)
  4. getMonthCount(Date startDate, Date endDate)
  5. getMonthEnd(Date date)
  6. getMonthEndDate(int year, int month)
  7. getMonthEndDate(Long day)
  8. getMonthFirstDays(Date startDate, Date endDate)
  9. getMonths(Date end, Date start)