The given date must either be an RFC2822 parseable date string or a DateTime
object. The timezone will be converted to GMT internally, but the point in
time remains the same.
/** * @test */ public function setDateAndGetDateSetAndGetTheDateHeader() { $now = \DateTime::createFromFormat(DATE_RFC2822, 'Tue, 22 May 2012 12:00:00 GMT'); $response = new Response(); $response->setDate($now); $this->assertEquals($now, $response->getDate()); $response->setDate('Tue, 22 May 2012 12:00:00 GMT'); $this->assertEquals($now, $response->getDate()); }