Here you can find the source of getEndTimeOfMonth(Timestamp timestamp)
public static Timestamp getEndTimeOfMonth(Timestamp timestamp)
//package com.java2s; import java.sql.Timestamp; import java.util.Calendar; public class Main { public static Timestamp getEndTimeOfMonth(Timestamp timestamp) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(timestamp.getTime()); calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH)); calendar.set(Calendar.HOUR_OF_DAY, calendar.getActualMaximum(Calendar.HOUR_OF_DAY)); calendar.set(Calendar.MINUTE, calendar.getActualMaximum(Calendar.MINUTE)); calendar.set(Calendar.SECOND, calendar.getActualMaximum(Calendar.SECOND)); calendar.set(Calendar.MILLISECOND, calendar.getActualMaximum(Calendar.MILLISECOND)); return new Timestamp(calendar.getTimeInMillis()); }//ww w .j av a2 s .c o m }