Here you can find the source of getLastOfMonth(Timestamp t1)
public static Timestamp getLastOfMonth(Timestamp t1)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { public static Timestamp getLastOfMonth(Timestamp t1) { Calendar a = new GregorianCalendar(); a.setTime(t1);//from ww w. j a v a2 s . com a.set(Calendar.DATE, 1); a.roll(Calendar.DATE, -1); return new Timestamp(a.getTimeInMillis()); } }