Java examples for java.sql:Timestamp
get Day End as java.sql.Timestamp
//package com.java2s; import java.util.Calendar; public class Main { public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp) { return getDayEnd(stamp, 0); }// ww w .j a v a 2s . 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()); } }