Here you can find the source of removeTime(Date date)
Parameter | Description |
---|---|
date | Date to remove the time part |
public static Date removeTime(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { /**//from w ww . j a v a 2 s . c o m * Remove the time of a date value * * @param date * Date to remove the time part * @return A date with its time set to 00:00:00 */ public static Date removeTime(Date date) { GregorianCalendar gc = new GregorianCalendar(); gc.setTime(date); gc.set(Calendar.HOUR_OF_DAY, 0); gc.set(Calendar.MINUTE, 0); gc.set(Calendar.SECOND, 0); gc.set(Calendar.MILLISECOND, 0); return gc.getTime(); } }