Java tutorial
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date rewindToBeginningOfDay(Date date) { Calendar cal = buildFromDate(date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } private static Calendar buildFromDate(Date from) { Calendar c = Calendar.getInstance(); c.setTime(from); return c; } }