Here you can find the source of dayEnd(Date dt)
Parameter | Description |
---|---|
dt | The given Date |
public static Date dayEnd(Date dt)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /**/*from w w w .java 2 s. c om*/ * Set a Date dt to the end of the day, that is, 11:59:59:999pm return the * new Date. This could be used for possible scheduling * * @param dt * The given Date * * @return date The day end Date for the given date */ public static Date dayEnd(Date dt) { Calendar cal = Calendar.getInstance(); cal.setTime(dt); 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(); } }