Java Date Value Check isDateInRange(Date startDt, Date endDt, Date theDate)

Here you can find the source of isDateInRange(Date startDt, Date endDt, Date theDate)

Description

is Date In Range

License

Apache License

Parameter

Parameter Description
startDt a parameter
endDt a parameter
theDate a parameter

Exception

Parameter Description
ParseException an exception

Return

boolean true or false

Declaration

public static boolean isDateInRange(Date startDt, Date endDt, Date theDate) throws ParseException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.text.ParseException;

import java.util.Date;

public class Main {
    /**/*from w w  w .ja  v  a2 s .com*/
     * 
     * @param startDt
     * @param endDt
     * @param theDate
     * @return boolean true or false
     * @throws ParseException
     */
    public static boolean isDateInRange(Date startDt, Date endDt, Date theDate) throws ParseException {
        //theDate in range?
        if (theDate.compareTo(startDt) == 0 || theDate.compareTo(endDt) == 0
                || (theDate.after(startDt) && theDate.before(endDt))) {
            return true;
        } else {
            return false;
        }
    }
}

Related

  1. isDateBefore(String date1, String date2)
  2. isDateFormat(String dateString)
  3. isDateFormat(String str, String format)
  4. isDateFormatString(String s, String dateFormat, Locale locale)
  5. isDateFormatValid(final String pattern)
  6. isDateInRange(Date toCheck, Date minRange, Date maxRange)
  7. IsDateOK(String date)
  8. isDateSortedAsc(List dates, String format)
  9. isDateTwo(String value)