private Date getLastDayOfMonth ( final Date date ) { final Calendar calendar = toGregorianCalendar ( date ) ; calendar . set ( Calendar . DAY_OF_MONTH , calendar . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; 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 ( ) ; }
Return the last day of month at 23h59 .