Here you can find the source of isSameDay(Date date1, Date date2)
public static boolean isSameDay(Date date1, Date date2)
//package com.java2s; //License from project: Apache License import java.text.SimpleDateFormat; import java.util.Date; public class Main { public final static String webFormat = "yyyy-MM-dd"; public static boolean isSameDay(Date date1, Date date2) { SimpleDateFormat sdf = new SimpleDateFormat(webFormat); return sdf.format(date1).equals(sdf.format(date2)); }//from w w w .ja v a2 s .c om public static String format(Date date, String format) { if (date == null) { return null; } return new SimpleDateFormat(format).format(date); } }