Here you can find the source of startOfDay(Date inDate, TimeZone timeZone)
Parameter | Description |
---|---|
inDate | The date to cacluate start of day from. |
public static Date startOfDay(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 w w w .j av a 2 s. c o m * Calculate the start of day date time (i.e. at 00:00) for a given date. * * @param inDate The date to cacluate start of day from. * @return The Date at the start of the day. */ public static Date startOfDay(Date inDate, TimeZone timeZone) { GregorianCalendar c1 = new GregorianCalendar(); c1.setTimeZone(timeZone); c1.setTime(inDate); GregorianCalendar c2 = new GregorianCalendar(c1.get(Calendar.YEAR), c1.get(Calendar.MONTH), c1.get(Calendar.DATE)); c2.setTimeZone(timeZone); return c2.getTime(); } }