Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Response.php

function Response::setDate

Sets the Date header.

@final

Return value

$this

File

vendor/symfony/http-foundation/Response.php, line 672

Class

Response
Response represents an HTTP response.

Namespace

Symfony\Component\HttpFoundation

Code

public function setDate(\DateTimeInterface $date) : static {
    $date = \DateTimeImmutable::createFromInterface($date);
    $date = $date->setTimezone(new \DateTimeZone('UTC'));
    $this->headers
        ->set('Date', $date->format('D, d M Y H:i:s') . ' GMT');
    return $this;
}
RSS feed
Powered by Drupal