Here you can find the source of equal(Date date1, Date date2)
public static boolean equal(Date date1, Date date2)
//package com.java2s; import java.text.SimpleDateFormat; import java.util.Date; public class Main { public static SimpleDateFormat dateFormater = new SimpleDateFormat( "yyyy-MMM-dd"); public static boolean equal(Date date1, Date date2) { return dateFormater.format(date1) .equals(dateFormater.format(date2)); }/* w w w . ja v a 2s. c om*/ }