Here you can find the source of startOfDay(Date date)
Parameter | Description |
---|---|
date | a parameter |
public static Date startOfDay(Date date)
//package com.java2s; //License from project: Creative Commons License import java.util.Calendar; import java.util.Date; public class Main { protected static Calendar CALENDAR = Calendar.getInstance(); /**/* w ww.ja va 2 s . c o m*/ * Get the first hour, minute, second of the date specified * @param date * @return */ public static Date startOfDay(Date date) { Calendar calendar = CALENDAR; synchronized (calendar) { calendar.setTime(date); calendar.set(Calendar.HOUR_OF_DAY, 0); calendar.set(Calendar.MILLISECOND, 0); calendar.set(Calendar.SECOND, 0); calendar.set(Calendar.MINUTE, 0); return calendar.getTime(); } } }