Here you can find the source of dayEnd(Date date)
public static Date dayEnd(Date date)
//package com.java2s; //License from project: Apache License import java.text.DateFormat; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static Date dayEnd(Date date) { if (date == null) return null; DateFormat dayGranularity = new SimpleDateFormat("ddMMyyyy"); DateFormat secondGranularity = new SimpleDateFormat("ddMMyyyy:HHmmss"); String today = dayGranularity.format(date); try {/* w ww. j a v a 2 s.c om*/ return secondGranularity.parse(today + ":235959"); } catch (ParseException e) { // short of a coding error this should never happen e.printStackTrace(); return null; } } }