Here you can find the source of startOfDay(Date date)
Parameter | Description |
---|---|
date | das Datum. |
public static Date startOfDay(Date date)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { /**/*w w w.j ava2s .c o m*/ * Resettet die Uhrzeit eines Datums. * @param date das Datum. * @return das neue Datum. */ public static Date startOfDay(Date date) { if (date == null) return null; Calendar cal = Calendar.getInstance(); cal.setTime(date == null ? new Date() : date); cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); return cal.getTime(); } }