Here you can find the source of startOfDay(final Date date)
public static Date startOfDay(final Date date)
//package com.java2s; //License from project: Open Source License import static java.util.Calendar.DAY_OF_MONTH; import static java.util.Calendar.MONTH; import static java.util.Calendar.YEAR; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static Date startOfDay(final Date date) { final GregorianCalendar dateCalendar = new GregorianCalendar(); dateCalendar.setTime(date);/*from w w w . j a v a 2 s. c o m*/ return new GregorianCalendar(dateCalendar.get(YEAR), dateCalendar.get(MONTH), dateCalendar.get(DAY_OF_MONTH)).getTime(); } }