Here you can find the source of compareToCal(Date sDate, Date eDate)
public static boolean compareToCal(Date sDate, Date eDate)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; import java.util.GregorianCalendar; public class Main { public static boolean compareToCal(Date sDate, Date eDate) { Calendar sCal = new GregorianCalendar(); sCal.setTime(sDate);// w ww . j a va 2 s . co m Calendar eCal = new GregorianCalendar(); eCal.setTime(eDate); return (sCal.getTimeInMillis() == eCal.getTimeInMillis() || before( sDate, eDate)); } public static boolean before(Date sDate, Date eDate) { Calendar sCal = new GregorianCalendar(); sCal.setTime(sDate); Calendar eCal = new GregorianCalendar(); eCal.setTime(eDate); return sCal.before(eCal); } }