Here you can find the source of isEqualByDay(Date date1, Date date2)
public static boolean isEqualByDay(Date date1, Date date2)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { public static boolean isEqualByDay(Date date1, Date date2) { Calendar cal1 = Calendar.getInstance(); cal1.setTime(date1);/*from www.j ava 2 s .c o m*/ Calendar cal2 = Calendar.getInstance(); cal2.setTime(date2); return cal1.get(Calendar.YEAR) == cal2.get(Calendar.YEAR) && cal1.get(Calendar.DAY_OF_YEAR) == cal2.get(Calendar.DAY_OF_YEAR); } }