Here you can find the source of sameDay(Date date1, Date date2)
public static boolean sameDay(Date date1, Date date2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static boolean sameDay(Date date1, Date date2) { Calendar c1 = new GregorianCalendar(); Calendar c2 = new GregorianCalendar(); c1.setTime(date1);//from w w w. j a v a 2s . c o m c2.setTime(date2); return c1.get(Calendar.DAY_OF_YEAR) == c2.get(Calendar.DAY_OF_YEAR); } }