Here you can find the source of getEndOfDay(Date date)
public static Date getEndOfDay(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date getEndOfDay(Date date) { if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date);/*from ww w . ja v a2 s.c o m*/ cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); Date ds = new Date(cal.getTimeInMillis()); return ds; } }