public function Response::setLastModified

Sets the Last-Modified HTTP header with a DateTime instance.

If passed a null value, it removes the header.

@api

Parameters

\DateTime $date A \DateTime instance:

Return value

Response

1 call to Response::setLastModified()
Response::setCache in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Sets the response's cache headers (validation and/or expiration).

File

drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php, line 808

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setLastModified(\DateTime $date = null) {
  if (null === $date) {
    $this->headers
      ->remove('Last-Modified');
  }
  else {
    $date = clone $date;
    $date
      ->setTimezone(new \DateTimeZone('UTC'));
    $this->headers
      ->set('Last-Modified', $date
      ->format('D, d M Y H:i:s') . ' GMT');
  }
  return $this;
}