Here you can find the source of startOfDay(Date aDate)
Parameter | Description |
---|---|
aDate | A date with time. |
public static Date startOfDay(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 v a 2 s . c o m * Compute day break of the date provided. * * @param aDate A date with time. * @return Day break of the date provided. The dawn of a new day. */ public static Date startOfDay(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, 0); Date dayBreak = cal.getTime(); return dayBreak; } }