Returns the HTTP header value converted to a date.
@api
string $key The parameter key:
\DateTime $default The default value:
\DateTime The filtered value
public function getDate($key, \DateTime $default = null) {
if (null === ($value = $this
->get($key))) {
return $default;
}
if (false === ($date = \DateTime::createFromFormat(DATE_RFC2822, $value))) {
throw new \RuntimeException(sprintf('The %s HTTP header is not parseable (%s).', $key, $value));
}
return $date;
}