Here you can find the source of endOfDay(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static Date endOfDay(Date date)
//package com.java2s; //License from project: Creative Commons License import java.util.Calendar; import java.util.Date; public class Main { protected static Calendar CALENDAR = Calendar.getInstance(); /**//from w w w .j a v a 2 s.c om * Get the last hour, minute, second of the date specified * @param date * @return */ public static Date endOfDay(Date date) { Calendar calendar = CALENDAR; synchronized (calendar) { calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 23); calendar.set(Calendar.MILLISECOND, 999); calendar.set(Calendar.SECOND, 59); calendar.set(Calendar.MINUTE, 59); return calendar.getTime(); } } }