Here you can find the source of isSameDay(Calendar calSource, Calendar calDesti)
public static boolean isSameDay(Calendar calSource, Calendar calDesti)
//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"); }/*from w ww . j a v a 2s.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); } }