public function Response::setDate

Sets the Date header.

@api

Parameters

\DateTime $date A \DateTime instance:

Return value

Response

1 call to Response::setDate()
Response::__construct in drupal/core/vendor/symfony/http-foundation/Symfony/Component/HttpFoundation/Response.php
Constructor.

File

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

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setDate(\DateTime $date) {
  $date
    ->setTimezone(new \DateTimeZone('UTC'));
  $this->headers
    ->set('Date', $date
    ->format('D, d M Y H:i:s') . ' GMT');
  return $this;
}