Here you can find the source of setToDayStartTime(Date date)
public static Date setToDayStartTime(Date date)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.*; public class Main { private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); public static Date setToDayStartTime(Date date) { Calendar calendar = Calendar.getInstance(); calendar.setTimeInMillis(date.getTime()); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MINUTE, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getTime(); }/*from w ww . ja va 2 s . c om*/ public static String getTime() { return sdfTime.format(new Date()); } }