Here you can find the source of isSameDay(Date date1, Date date2)
public static boolean isSameDay(Date date1, Date date2)
//package com.java2s; import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static boolean isSameDay(Date date1, Date date2) { if (date1 == null && date2 == null) return true; if (date1 == null || date2 == null) return false; Calendar cal1 = GregorianCalendar.getInstance(); cal1.setTime(date1);/* w w w .j a va2 s . c o m*/ Calendar cal2 = GregorianCalendar.getInstance(); cal2.setTime(date2); return (cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR)) && (cal1.get(Calendar.MONTH) == cal2.get(Calendar.MONTH) && (cal1.get(Calendar.DATE) == cal2.get(Calendar.DATE))); } }