Here you can find the source of getCurrentDayStartDate(Date date)
public static Timestamp getCurrentDayStartDate(Date date)
//package com.java2s; //License from project: Open Source License import java.sql.Timestamp; import java.util.Calendar; import java.util.Date; public class Main { public static Timestamp getCurrentDayStartDate(Date date) { Calendar rightNow = Calendar.getInstance(); rightNow.setTime(date);//from w ww. java 2 s . co m rightNow.set(Calendar.HOUR_OF_DAY, 0); rightNow.set(Calendar.MILLISECOND, 0); rightNow.set(Calendar.SECOND, 0); rightNow.set(Calendar.MINUTE, 0); rightNow.set(Calendar.MONTH, rightNow.get(Calendar.MONTH)); return new Timestamp(rightNow.getTimeInMillis()); } }