Here you can find the source of getEndOfMonth(Date currentDate)
public static Date getEndOfMonth(Date currentDate)
//package com.java2s; //License from project: Open Source License import java.util.*; public class Main { /**/* w w w . j a va 2 s . c o m*/ * @return the date that is the end of the month that the passed date is in */ public static Date getEndOfMonth(Date currentDate) { Calendar cal = Calendar.getInstance(); cal.setTime(currentDate); cal.set(Calendar.DATE, cal.getActualMaximum(Calendar.DATE)); return cal.getTime(); } }