Here you can find the source of getDayEnd(Date date)
public static Date getDayEnd(Date date)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Date getDayEnd(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTime(date);/*from w w w .j ava 2s.co m*/ calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.add(Calendar.DAY_OF_MONTH, 1); calendar.add(Calendar.MILLISECOND, -1); return calendar.getTime(); } }