Here you can find the source of getDayEnd(java.sql.Timestamp stamp, int daysLater)
public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp, int daysLater)
//package com.java2s; import java.util.Calendar; public class Main { public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp) { return getDayEnd(stamp, 0); }/*from w w w .j a v a2 s . c o m*/ public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp, int daysLater) { Calendar tempCal = Calendar.getInstance(); tempCal.setTime(new java.util.Date(stamp.getTime())); tempCal.set(tempCal.get(Calendar.YEAR), tempCal.get(Calendar.MONTH), tempCal.get(Calendar.DAY_OF_MONTH), 23, 59, 59); tempCal.add(Calendar.DAY_OF_MONTH, daysLater); return new java.sql.Timestamp(tempCal.getTime().getTime()); } }