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.text.DateFormat; import java.text.SimpleDateFormat; import java.util.*; public class Main { public static final String dateFormat = "yyyy-MM-dd"; public static boolean isSameDay(Date date1, Date date2) { DateFormat fmt = getFormat(dateFormat); return fmt.format(date1).equals(fmt.format(date2)); }/* ww w . j a v a 2s . c o m*/ public static final DateFormat getFormat(String format) { return new SimpleDateFormat(format); } public static final String format(Date date, String formate) { if (date == null) { return ""; } return getFormat(formate).format(date); } public static final String format(Long dateTmie, String formate) { Date date = new Date(dateTmie); return getFormat(formate).format(date); } }