Here you can find the source of compare(Date date, Date fromDate, Date toDate)
public static Boolean compare(Date date, Date fromDate, Date toDate)
//package com.java2s; //License from project: Apache License import java.util.Calendar; import java.util.Date; public class Main { public static Boolean compare(Date date, Date fromDate, Date toDate) { Calendar date1 = Calendar.getInstance(); date1.setTime(date);//from w ww .j av a 2s. c o m Calendar from = Calendar.getInstance(); from.setTime(fromDate); Calendar to = Calendar.getInstance(); to.setTime(toDate); if (date1.after(from) && date1.before(to)) { return false; } return true; } }