Here you can find the source of getStartTimeOfDay(Date date)
Parameter | Description |
---|---|
date | The date-time |
public static Date getStartTimeOfDay(Date date)
//package com.java2s; //file LICENSE in the root of the DomainHealth distribution. import static java.util.Calendar.*; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**/* w w w . j a v a 2s . c o m*/ * Get the start time date-time of the given day (ie. midnight) * * @param date The date-time * @return The date-time of midnight of the day */ public static Date getStartTimeOfDay(Date date) { Calendar currentCalendar = new GregorianCalendar(); currentCalendar.setTime(date); currentCalendar.set(HOUR_OF_DAY, 0); currentCalendar.set(MINUTE, 0); currentCalendar.set(SECOND, 0); return currentCalendar.getTime(); } }