Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /** * getDateEnd * @param date the date that needs to be converted to an end date * @return a date at 11:59 PM */ public static Date getDateEnd(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 59); long time = cal.getTimeInMillis(); date.setTime(time); return date; } }