You are here

public function Response::setDate in RESTful 7.2

Sets the Date header.

Parameters

\DateTime $date: A \DateTime instance

Overrides ResponseInterface::setDate

1 call to Response::setDate()
Response::__construct in src/Http/Response.php
Constructor.

File

src/Http/Response.php, line 377
Contains \Drupal\restful\Http\Response.

Class

Response

Namespace

Drupal\restful\Http

Code

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