Here you can find the source of isSameDay(Date dateSource, Date dateDesti)
public static boolean isSameDay(Date dateSource, Date dateDesti)
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static boolean isSameDay(Date dateSource, Date dateDesti) { if (dateSource == null || dateDesti == null) { throw new IllegalArgumentException("The date must not be null"); }//w ww . j a va2 s.c om Calendar objCalendarSource = Calendar.getInstance(); objCalendarSource.setTime(dateSource); Calendar objCalendarDesti = Calendar.getInstance(); objCalendarDesti.setTime(dateDesti); return isSameDay(objCalendarSource, objCalendarDesti); } public static boolean isSameDay(Calendar calSource, Calendar calDesti) { if (calSource == null || calDesti == null) { throw new IllegalArgumentException("The date must not be null"); } return calSource.get(Calendar.ERA) == calDesti.get(Calendar.ERA) && calSource.get(Calendar.YEAR) == calDesti .get(Calendar.YEAR) && calSource.get(Calendar.DAY_OF_YEAR) == calDesti .get(Calendar.DAY_OF_YEAR); } }