Here you can find the source of getStartOfDay(Date day)
public static long getStartOfDay(Date day)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static long getStartOfDay(Date day) { Calendar startOfDay = Calendar.getInstance(); startOfDay.setTime(day);//from w ww . j a v a2s.c o m startOfDay.set(Calendar.HOUR_OF_DAY, 0); startOfDay.set(Calendar.MINUTE, 0); startOfDay.set(Calendar.SECOND, 0); startOfDay.set(Calendar.MILLISECOND, 0); return startOfDay.getTimeInMillis(); } }