{@inheritdoc}

@throws NotFoundHttpException When invalid date given
357329
public function apply(Request $request, ParamConverter $configuration)
    {
        $param = $configuration->getName();

        if (!$request->attributes->has($param)) {
            return false;
        }

        $options = $configuration->getOptions();
        $value = $request->attributes->get($param);

        if (!$value && $configuration->isOptional()) {
            $request->attributes->set($param, null);

            return true;
        }

        $class = $configuration->getClass();

        if (isset($options['format'])) {
            $date = $class::createFromFormat($options['format'], $value);

            if (0 < DateTime::getLastErrors()['warning_count']) {
                $date = false;
            }

            if (!$date) {
                throw new NotFoundHttpException(sprintf('Invalid date given for parameter "%s".', $param));
            }
        } else {
            if (false === strtotime($value)) {
                throw new NotFoundHttpException(sprintf('Invalid date given for parameter "%s".', $param));
            }

            $date = new $class($value);
        }

        $request->attributes->set($param, $date);

        return true;
    }
881925
public function isValid($value = null, $context = null)
    {
        $isValid = parent::isValid($value);
        $date    = $this->convertToDateTime($value);

        if (!$isValid || !$date) {
            return false;
        }

        $now = new DateTime();

        $now->setTime(23, 59, 59);
        $date->setTime(0, 0, 0);

        if ($date > $now || $date->diff($now)->y < $this->minimum) {
            $this->error(self::NOT_GREATER);

            return false;
        }

        return true;
    }
1190740
@Override
    void setStopDate(String newStopDate) throws IllegalArgumentException {

        try {
            if (newStopDate.contains(":")) {
                // User passed in a time as well as date
                setStopDate(defaultDateTimeFormat.parse(newStopDate));
            } else {
                // when stop date is supplied with no time, we need to add 1 day - 1 ms
                // to make the stop date be treated as a maximum
                Date stopDate = new Date(defaultDateFormat.parse(newStopDate).getTime() + 86400000 - 1);
                setStopDate(stopDate);
            }
        } catch (ParseException e) {
            try {
                if (newStopDate.contains(":")) {
                    // User passed in a time as well as date
                    setStopDate(isoDateTimeFormat.parse(newStopDate));
                } else {
                    // when stop date is supplied with no time, we need to add 1 day - 1 ms
                    // to make the stop date be treated as a maximum
                    Date stopDate = new Date(isoDateFormat.parse(newStopDate).getTime() + 86400000 - 1);
                    setStopDate(stopDate);
                }
            } catch (ParseException p) {
                throw new IllegalArgumentException(getLocalizedString("BL_INVALID_MAXDATE"), e);
            }
        }
    }
613626
public static function isDateString($value, $name)
    {
        self::isString($value, 'value');

        try {
            new \DateTime($value);

            return true;
        } catch (\Exception $e) {
            throw new \InvalidArgumentException(
                sprintf(
                    Resources::ERROR_INVALID_DATE_STRING,
                    $name,
                    $value
                )
            );
        }
    }
737919
@Override
    public void setDate(int parameterIndex, Date x) throws SQLException
    {
        checkParameterBounds(parameterIndex);
        throw SQLError.noSupport();
    }
1275639
public function checkLocalizedDate($value, ExecutionContextInterface $context)
    {
        $format = LangQuery::create()->findOneByByDefault(true)->getDatetimeFormat();

        if (false === \DateTime::createFromFormat($format, $value)) {
            $context->addViolation(
                Translator::getInstance()->trans(
                    "Date '%date' is invalid, please enter a valid date using %fmt format",
                    [
                        '%fmt'  => $format,
                        '%date' => $value
                    ]
                )
            );
        }
    }
464952
@Override
    public final int doEndTag() throws JspException {
	String date_formatted = default_text;

	if (output_date != null) {
	    // Get the pattern to use
	    SimpleDateFormat sdf;
	    String pat = pattern;

	    if (pat == null && patternid != null) {
		Object attr = pageContext.findAttribute(patternid);
		if (attr != null) pat = attr.toString();
	    }

	    if (pat == null) {
		sdf = new SimpleDateFormat();
		pat = sdf.toPattern();
	    }

	    // Get a DateFormatSymbols
	    if (symbolsRef != null) {
		symbols = (DateFormatSymbols) pageContext.findAttribute(symbolsRef);
		if (symbols == null) {
		    throw new JspException("datetime format tag could not find dateFormatSymbols for symbolsRef \"" + symbolsRef + "\".");
		}
	    }

	    // Get a SimpleDateFormat using locale if necessary
	    if (localeRef != null) {
		Locale locale = (Locale) pageContext.findAttribute(localeRef);
		if (locale == null) {
		    throw new JspException("datetime format tag could not find locale for localeRef \"" + localeRef + "\".");
		}

		sdf = new SimpleDateFormat(pat, locale);
	    }
	    else if (locale_flag) {
		sdf = new SimpleDateFormat(pat, pageContext.getRequest().getLocale());
	    }
	    else if (symbols != null) {
		sdf = new SimpleDateFormat(pat, symbols);
	    }
	    else {
		sdf = new SimpleDateFormat(pat);
	    }

	    // See if there is a timeZone
	    if (timeZone_string != null) {
		TimeZone timeZone = (TimeZone) pageContext.getAttribute(timeZone_string, PageContext.SESSION_SCOPE);
		if (timeZone == null) {
		    throw new JspTagException("Datetime format tag timeZone " + "script variable \"" + timeZone_string + " \" does not exist");
		}
		sdf.setTimeZone(timeZone);
	    }

	    // Format the date for display
	    date_formatted = sdf.format(output_date);
	}

	try {
	    pageContext.getOut().write(date_formatted);
	}
	catch (Exception e) {
	    throw new JspException("IO Error: " + e.getMessage());
	}

	return EVAL_PAGE;
    }
1004167
function parseAndCheck(oDateFormat, sValue) {
			var oDate = oDateFormat.parse(sValue);
			if (!oDate) {
				throw new Error("Not a valid " + oPropertyMetadata.$Type + " value: " + sValue);
			}
			return oDate;
		}
734415
function parseDate(value) {
  let date = value;
  if (!value) {
    return new Date().getTime();
  }
  if (isObject(date)) {
    date = date.value || date;
  }
  // array
  if (isArray(date)) {
    date = new Date(...date).getTime();
  } else {
    // string number  null 、''、undefined
    date = new Date(date).getTime();
  }
  if (date) {
    return date;
  }
  console.warn('Invalid Date ', value);
  return new Date().getTime();
}
1349052
private function validateDateTime($value): void
    {
        try {
            if(
                is_a($value, DateTime::class) ||
                is_null($value) ||
                $value === 'now'
            ) {
                // Expected and valid values, no need to attempt conversion
            } else {
                if($this->isUnixTimestamp($value)) {
                    // Try making a DateTime with a UNIX Timestamp from a string
                    DateTime::createFromFormat("U.u", $this->unixTimestampAsUuFormat($value));
                } else {
                    // Try making a DateTime with whatever remains
                    new DateTime($value);
                }
            }
        } catch (Exception $e) {
            throw new TypeValidationException('Attempted to pass non-date[time] value to date[time] type');
        }
    }
1238058
function date(value) {
  var parsedDate = Date.parse(value);

  // couldn't parse it
  if (typeOf(parsedDate) != 'number') {
    return throwModifierError('date', value, {message: 'Invalid Date'});
  }

  return new Date(parsedDate);
}
203885
public static function date(string $value): ?JavascriptFunction
    {
        $timestamp = strtotime($value);

        // wrong date format
        if (!$timestamp) {
            return null;
        }

        return new JavascriptFunction('kendo.parseDate("' . date('Y-m-d H:i:s', $timestamp) . '")');
    }
162904
public static function isValid($date)
	{
		if(self::validateXSDDateTimeFormat($date) && self::validateXSDDateTimeValue($date))
		{
			return true;
		}
		else
		{
			return false;
		}
	}
310444
public void setDate(String date) {
        if (date == null || date.trim().isEmpty()) {
            throw new IllegalArgumentException("Date cannot be null or empty.");
        }
        try {
            Date dateToSet = new SimpleDateFormat("MM/dd/yyyy").parse(date);
            Calendar to = Calendar.getInstance();
            to.setTime(dateToSet);
            setDate(to);
        } catch (ParseException e) {
            throw new IllegalArgumentException(e);
        }
    }
616902
public function filter($value)
    {
        try {
            $result = $this->normalizeDateTime($value);
        } catch (\Exception $e) {
            // DateTime threw an exception, an invalid date string was provided
            throw new Exception\InvalidArgumentException('Invalid date string provided', $e->getCode(), $e);
        }

        if ($result === false) {
            return $value;
        }

        return $result;
    }
534010
function (value) {
    var date = new Date(value)
    assertErr(!isNaN(date.getTime()), TypeError, 'Field error: value is an invalid Date')
    return date
  }
371462
protected function parseAsDateTime($value)
    {
        if (empty($value) && !is_numeric($value)) {
            return null;
        }

        if (is_string($value)) {
            try {
                $value = new DateTime($value);
            } catch (Exception $e) {
                throw new InvalidArgumentException(sprintf(
                    'Invalid date/time value: %s',
                    $e->getMessage()
                ), $e->getCode(), $e);
            }
        }

        if (!$value instanceof DateTimeInterface) {
            throw new InvalidArgumentException(
                'Invalid date/time value. Must be a date/time string or an implementation of DateTimeInterface.'
            );
        }

        return $value;
    }