Here you can find the source of getMonthLastDay(Date date)
public static Date getMonthLastDay(Date date)
//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(); } }