Here you can find the source of getEndOfDay(Long date)
public static Long getEndOfDay(Long date)
//package com.java2s; //License from project: Apache License import java.util.*; public class Main { public static Long getEndOfDay(Long date) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(date);/*from ww w . j a v a 2 s . c om*/ calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MINUTE, 59); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MILLISECOND, 999); return calendar.getTimeInMillis(); } public static Date getEndOfDay(Date date) { long time = getEndOfDay(date.getTime()); return new Date(time); } }