Here you can find the source of endOfDay(final Date date)
public static Calendar endOfDay(final Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Calendar endOfDay(final Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);//ww w . ja va 2 s . co m setEndOfDay(calendar); return calendar; } public static void setEndOfDay(final Calendar calendar) { calendar.add(Calendar.DAY_OF_MONTH, 1); setStartOfDay(calendar); } public static void setStartOfDay(final Calendar calendar) { calendar.set(Calendar.HOUR, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); } }