Here you can find the source of getEndOfTheDate(Date date)
Parameter | Description |
---|---|
date | the Date object |
public static Date getEndOfTheDate(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**//w w w. j av a 2 s . c om * Precondition: date argument is not null. * Returns a Date object using date with time set to end of day. * @param date the Date object * @return a Date object set to end of the date */ public static Date getEndOfTheDate(Date date) { assert date != null; Calendar c = Calendar.getInstance(); c.setTime(date); c.set(Calendar.HOUR_OF_DAY, 23); c.set(Calendar.MINUTE, 59); c.set(Calendar.SECOND, 59); c.set(Calendar.MILLISECOND, 999); return c.getTime(); } }