Here you can find the source of clearTime(Date date)
public static Date clearTime(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static Date clearTime(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date);//from ww w . j ava 2 s . c om cal.clear(Calendar.HOUR_OF_DAY); cal.clear(Calendar.MINUTE); cal.clear(Calendar.SECOND); cal.clear(Calendar.MILLISECOND); return cal.getTime(); } }