Check if a date exists in the index. Will be inferred from string in case
 you pass a string. Recommened specifying the full date as a DateTime object.
338401
def include? date_time
      return false unless date_time.is_a?(String) || date_time.is_a?(DateTime)

      if date_time.is_a?(String)
        date_precision = Helper.determine_date_precision_of date_time
        date_time = Helper.date_time_from date_time, date_precision
      end

      result, = @data.bsearch { |d| d[0] >= date_time }
      result && result == date_time
    end
52684
def _validate_date_str(str_):
    """"""

    if not str_:
        return None

    # Convert to datetime so we can validate it's a real date that exists then
    # convert it back to the string.
    try:
        date = datetime.strptime(str_, DATE_FMT)
    except ValueError:
        msg = 'Invalid date format, should be YYYY-MM-DD'
        raise argparse.ArgumentTypeError(msg)

    return date.strftime(DATE_FMT)
93606
def slice first, last
      if first.is_a?(Integer) && last.is_a?(Integer)
        DateTimeIndex.new(to_a[first..last], freq: @offset)
      else
        first = Helper.find_date_string_bounds(first)[0] if first.is_a?(String)
        last  = Helper.find_date_string_bounds(last)[1] if last.is_a?(String)

        slice_between_dates first, last
      end
    end
666490
def _read_date_from_string(str1):
    
    full_date = [int(x) for x in str1.split('/')]
    return datetime.date(full_date[0], full_date[1], full_date[2])
1123689
@NonNull
    @Override
    public MutableArray setDate(int index, Date value) {
        return setValue(index, value);
    }
161251
def valid_time(x: str) -> bool:
    
    if isinstance(x, str) and (
        re.match(TIME_PATTERN1, x) or re.match(TIME_PATTERN2, x)
    ):
        return True
    else:
        return False
1107704
def set_date_bounds(self, date):
        '''
        
        '''
        if date is not None:
            split = date.split('~')
            if len(split) == 1:
                self._lbound = ts2dt(date)
                self._rbound = ts2dt(date)
            elif len(split) == 2:
                if split[0] != '':
                    self._lbound = ts2dt(split[0])
                if split[1] != '':
                    self._rbound = ts2dt(split[1])
            else:
                raise Exception('Date %s is not in the correct format' % date)
515191
def parse_date(dateString):
    ''''''
    if not dateString:
        return None
    for handler in _date_handlers:
        try:
            date9tuple = handler(dateString)
        except (KeyError, OverflowError, ValueError):
            continue
        if not date9tuple:
            continue
        if len(date9tuple) != 9:
            continue
        return date9tuple
    return None
1179788
def _occursOn(self, myDate):
        
        # TODO analyse which is faster (rrule or db) and test that first
        if myDate not in self.repeat:
            return False
        if CancellationPage.events.child_of(self)                            \
                           .filter(except_date=myDate).exists():
            return False
        return True
436962
def match_date(self, value, strict=False):
        """"""
        value = stringify(value)
        try:
            parse(value)
        except Exception:
            self.shout('Value %r is not a valid date', strict, value)
1065781
function stringDate(value) {
    //  Empty string
    if (!value.length)
        return false;
    //  MM.DD.YYYY. - format
    //  valid separators -> . , / - \s
    if (value.search(/[.,/\\-]/g) > -1) {
        var date = value.split(/[.,/-\s]/g);
        var month = +date[0];
        var day = +date[1];
        var isValid = void 0;
        for (var _i = 0, months_2 = months_1.months; _i < months_2.length; _i++) {
            var _month = months_2[_i];
            (_month.ord >= month && _month.days >= day) ? isValid = true : isValid = false;
        }
        return isValid ? !isNaN(Date.parse(value)) : false;
    }
    //  YYYY-MM-DDTTT:HH:MM.SSSZ - format
    return !isNaN(Date.parse(value));
}
151706
@Override
    public void setDate(int parameterIndex, Date x) throws SQLException {
        internalStmt.setDate(parameterIndex, x);
    }
608740
@Override
    public Date getDate(int index) {
        check(index);
        return DateUtils.fromJson(getString(index));
    }
741989
public boolean isExists(String index) {
        IndicesExistsRequestBuilder indicesExistsRequestBuilder =
                admin().indices().prepareExists(index);
        return JMElasticsearchUtil
                .logRequestQueryAndReturn("isExists",
                        indicesExistsRequestBuilder,
                        indicesExistsRequestBuilder.execute())
                .isExists();
    }
610865
private boolean _readDate()
	{
		int endIndex = pos + 10;
		if( endIndex <= len )
		{
			_date = text.substring( pos, endIndex );
			pos += 10;
			return true;
		}
		pos = len;
		return false;
	}
1156427
def has_data_for_dates(series_or_df, first_date, last_date):
    
    dts = series_or_df.index
    if not isinstance(dts, pd.DatetimeIndex):
        raise TypeError("Expected a DatetimeIndex, but got %s." % type(dts))
    first, last = dts[[0, -1]]
    return (first <= first_date) and (last >= last_date)
596804
def index(self, date):
        
        for (i, (start, end, ruler)) in enumerate(self.table):
            if start <= date.jd <= end:
                return i
        return None