Here you can find the source of dayStart(final Calendar cal)
private static Calendar dayStart(final Calendar cal)
//package com.java2s; import java.util.Calendar; public class Main { private static Calendar dayStart(final Calendar cal) { cal.get(Calendar.HOUR_OF_DAY); // force recalculation of internal fields cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); cal.get(Calendar.HOUR_OF_DAY); // force recalculation of internal fields return cal; }// ww w .jav a 2 s . c om }