Here you can find the source of isSameDay(Date d1, Date d2)
public static boolean isSameDay(Date d1, Date d2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static boolean isSameDay(Date d1, Date d2) { return getDateWithoutTimePart(d1).compareTo(getDateWithoutTimePart(d2)) == 0; }/*from w w w.j a v a 2 s . c om*/ public static Date getDateWithoutTimePart(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(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(); } }