Here you can find the source of endOfDay(Date aDate)
Parameter | Description |
---|---|
aDate | a parameter |
public static Date endOfDay(Date aDate)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**/* w ww .ja va 2s .c o m*/ * Compute midnight of the date provided. * * @param aDate * @return Midnight of the date provided. */ public static Date endOfDay(Date aDate) { Calendar cal = GregorianCalendar.getInstance(); cal.setTime(aDate); cal.set(Calendar.MILLISECOND, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.HOUR_OF_DAY, 24); Date midnight = cal.getTime(); return midnight; } }