This method determines whether the given date falls in the range of
dates covered by this exception. Note that this method assumes that both
the start and end date of this exception have been set.

@param date Date to be tested
@return Boolean value
433905
public boolean contains(Date date)
   {
      boolean result = false;

      if (date != null)
      {
         result = (DateHelper.compare(getFromDate(), getToDate(), date) == 0);
      }

      return (result);
   }
1159853
public boolean activeOn (LocalDate date) {
        // first check for exceptions
        CalendarDate exception = calendar_dates.get(date);

        if (exception != null)
            return exception.exception_type == 1;

        else if (calendar == null)
            return false;

        else {
            int gtfsDate = date.getYear() * 10000 + date.getMonthValue() * 100 + date.getDayOfMonth();
            boolean withinValidityRange = calendar.end_date >= gtfsDate && calendar.start_date <= gtfsDate;

            if (!withinValidityRange) return false;

            switch (date.getDayOfWeek()) {
                case MONDAY:
                    return calendar.monday == 1;
                case TUESDAY:
                    return calendar.tuesday == 1;
                case WEDNESDAY:
                    return calendar.wednesday == 1;
                case THURSDAY:
                    return calendar.thursday == 1;
                case FRIDAY:
                    return calendar.friday == 1;
                case SATURDAY:
                    return calendar.saturday == 1;
                case SUNDAY:
                    return calendar.sunday == 1;
                default:
                    throw new IllegalArgumentException("unknown day of week constant!");
            }
        }
    }
25762
public static boolean isValid(String date, String pattern) {
        Date d = parseDate(date, pattern);
        return d != null && format(d, pattern).equals(date);
    }
39330
private boolean isThisDateValid(String dateToValidate, String dateFromat) {
        if (dateToValidate == null) {
            return false;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(dateFromat);
        sdf.setLenient(false);
        try {
            //if not valid, it will throw ParseException
            Date date = sdf.parse(dateToValidate);
        } catch (ParseException e) {
            e.printStackTrace();
            return false;
        }
        return true;
    }
583180
public static boolean isExpired(Date startDate, DateField dateField, int timeLength, Date checkedDate) {
		final Date endDate = offset(startDate, dateField, timeLength);
		return endDate.after(checkedDate);
	}
1098965
@Deprecated
	public static boolean isValidDate(String date) {
		try {
			convertStringDateToTime(date);
			return true;
		} catch (IllegalArgumentException err) {
			return false;
		}
	}
89975
public Date getStartDate() {
        DateRange range = getSelectedRange();
        return range == null ? null : range.getStartDate();
    }
1357796
public static final synchronized Date parseDate(String date) {
		try {
			return dateFormat.parse(date);
		} catch(ParseException e) {
			throw new RuntimeException(e);
		}
	}
610865
private boolean _readDate()
	{
		int endIndex = pos + 10;
		if( endIndex <= len )
		{
			_date = text.substring( pos, endIndex );
			pos += 10;
			return true;
		}
		pos = len;
		return false;
	}
465731
public boolean contains(final Date date) {
        ArgUtils.notNull(date, "date");
        
        for(EraPeriod period : periods) {
            if(period.contains(date)) {
                return true;
            }
        }
        
        return false;
    }
170727
public function containsDate($date): bool
    {
        $date = Date::castFrom($date);
        if (!$this->start->isBefore($date) && !$this->start->equals($date)) {
            return false;
        }

        if (!$this->end->isAfter($date) && !$this->end->equals($date)) {
            return false;
        }

        return true;
    }
175494
public static Date getDayDate(Date date) {
		Calendar calendar = getCalendar();
		calendar.setTime(date);
		return getDayDate(calendar);
	}
1350088
public static boolean isBetween(@NotNull final Date date, @NotNull final Date start, @NotNull final Date end) {
		if (date == null || start == null || end == null || start.after(end)) {
			throw new IllegalArgumentException("some date parameters is null or dateBein after dateEnd");
		}
		return !date.before(start) && !date.after(end);
	}
112847
public boolean includes(Date date)
    {
        return (start == null || !start.after(date)) && 
               (end == null   || date.before(end));
    }
371327
public function ContextsContainDate( $date )
	{
		if ( is_string( $date ) )
			$date = DateTime::createFromFormat( "!Y-m-d", $date );

		if ( ! is_a( $date, 'DateTime' ) )
		{
			throw new Exception( 'Date parameter passes to ContextsFilter::ContextsContainDate is not a string or DateTime object' );
		}

		$filtered = array_filter( $this->contexts, function ( $context ) use( $date ) {
			// The context may be invalid in which case exclude
			if ( ! isset( $context['period'] ) || ! isset( $context['period']['startDate'] ) || ! isset( $context['period']['endDate'] ) ) return false;

			$startDate = DateTime::createFromFormat( "!Y-m-d", $context['period']['startDate'] );
			if ( ! $context['period']['is_instant'] && $startDate >= $date ) return false;

			$endDate   = DateTime::createFromFormat( "!Y-m-d", $context['period']['endDate'] );
			return $context['period']['is_instant'] ? $endDate == $date : $endDate >= $date;
		} );

		return new ContextsFilter( $this->instance, $filtered );
	}
1292037
public static boolean isAM(Date date) {
    return dateToCalendar(date).get(Calendar.AM_PM) == Calendar.AM;
  }
740245
@Override
    public boolean isIMMDate(final LocalDate date) {
        boolean same = false;

        final List<LocalDate> dates = getIMMDates(date.minusDays(1), date, QUARTERLY);

        if (!dates.isEmpty()) {
            same = date.equals(dates.get(0));
        }

        return same;
    }