Here you can find the source of getLastDayofMonth(Date date1)
public static Date getLastDayofMonth(Date date1)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Main { public static Date getLastDayofMonth(Date date1) { Calendar cld = Calendar.getInstance(); cld.setTime(date1);//from w w w . j a va 2 s.c o m cld.set(5, 1); return cld.getTime(); } public static String getTime() { Timestamp time = new Timestamp(Calendar.getInstance().getTime().getTime()); return time.toString(); } }