Here you can find the source of isSameDay(Calendar cal1, Calendar cal2)
public static boolean isSameDay(Calendar cal1, Calendar cal2)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static boolean isSameDay(Date date1, Date date2) { return isSameDay(toCalendar(date1), toCalendar(date2)); }/*from w w w . j av a2 s .c o m*/ public static boolean isSameDay(Calendar cal1, Calendar cal2) { int year1 = cal1.get(Calendar.YEAR); int day1 = cal1.get(Calendar.DAY_OF_YEAR); int year2 = cal2.get(Calendar.YEAR); int day2 = cal2.get(Calendar.DAY_OF_YEAR); if (year1 != year2) { return false; } if (day1 != day2) { return false; } return true; } public static Calendar toCalendar(Date date) { Calendar cal = Calendar.getInstance(); cal.setTime(date); return cal; } }