Here you can find the source of getLastDayOfMonth(Date sDate)
@SuppressWarnings("deprecation") public static Date getLastDayOfMonth(Date sDate)
//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; } }