Here you can find the source of getStartDay(Date date)
public static GregorianCalendar getStartDay(Date date)
//package com.java2s; //License from project: BSD License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { private static int[] ORDERED_DATE_FIELD = new int[] { // DST_OFFSET Calendar.ZONE_OFFSET, Calendar.MILLISECOND, Calendar.SECOND, Calendar.MINUTE, Calendar.HOUR_OF_DAY, Calendar.DAY_OF_MONTH, Calendar.MONTH }; public static GregorianCalendar getStartDay(Date date) { GregorianCalendar cal = new GregorianCalendar(); cal.setTime(date);/*from w ww. jav a 2 s .com*/ for (int field = 0; field < 5; field++) // reset all to Calendar.HOUR_OF_DAY cal.set(ORDERED_DATE_FIELD[field], 0); return cal; } }