Here you can find the source of stripTimeComponent(Calendar cal)
public static void stripTimeComponent(Calendar cal)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { /** /*w ww .j a va 2 s .c o m*/ * Strips the time component from a Calendar object, leaving only the date component */ public static void stripTimeComponent(Calendar cal) { cal.set(Calendar.HOUR_OF_DAY, 0); cal.set(Calendar.MINUTE, 0); cal.set(Calendar.SECOND, 0); cal.set(Calendar.MILLISECOND, 0); } /** * Strips the time component of a Date object, leaving only the date component */ public static void stripTimeComponent(Date date) { if (date == null) { return; } else { Calendar cal = Calendar.getInstance(); cal.setTime(date); stripTimeComponent(cal); date = cal.getTime(); } } }