Here you can find the source of endOfDay(Date inDate, TimeZone timeZone)
Parameter | Description |
---|---|
inDate | The given date. |
public static Date endOfDay(Date inDate, TimeZone timeZone)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; import java.util.TimeZone; public class Main { /**//from ww w .jav a 2 s . co m * Calculate the date time at the end of the day (one millisecond before midnight) * for the given date. * * @param inDate The given date. * @return The Date at the end of the day. */ public static Date endOfDay(Date inDate, TimeZone timeZone) { Calendar inCalendar = new GregorianCalendar(); inCalendar.setTimeZone(timeZone); inCalendar.setTime(inDate); Calendar nextDay = new GregorianCalendar(inCalendar.get(Calendar.YEAR), inCalendar.get(Calendar.MONTH), inCalendar.get(Calendar.DAY_OF_MONTH) + 1); nextDay.setTimeZone(timeZone); return new Date(nextDay.getTime().getTime()); } }