Java Date Compare compare(Date date, Date fromDate, Date toDate)

Here you can find the source of compare(Date date, Date fromDate, Date toDate)

Description

compare

License

Apache License

Declaration

public static Boolean compare(Date date, Date fromDate, Date toDate) 

Method Source Code

//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;

    }
}

Related

  1. after(String format, String baseDate, String compareDate)
  2. compare(Date d1, Date d2)
  3. compare(Date d1, Date d2)
  4. compare(Date d1, Date d2)
  5. compare(Date date1, Date date2, String format)
  6. Compare(Date dtA, Date dtB, boolean bUnkIsPast)
  7. compare(Date start, Date end)
  8. compare(Date start, String end)