Here you can find the source of endOfDay(Date date)
Parameter | Description |
---|---|
date | das Datum. |
public static Date endOfDay(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**/*from www.j a v a 2 s.c o m*/ * Setzt die Uhrzeit eines Datums auf 23:59:59.999. * @param date das Datum. * @return das neue Datum. */ public static Date endOfDay(Date date) { if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date == null ? new Date() : date); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); return cal.getTime(); } }