src/Response.php
public function withExpires(DateTime $date)
    {
        $timezone = new DateTimeZone("PRC");

        $this->withoutHeader('Expires');
        $date->setTimezone($timezone);
        $this->withHeader('Expires', $date->format('D, d M Y H:i:s') . ' GMT');

        $maxAge = $date->getTimestamp() - (new DateTime('now', $timezone))->getTimestamp();
        $this->withMaxAge($maxAge);

        return $this;
    }
public function withExpires(DateTime $date)
    {
        $timezone = new DateTimeZone("PRC");

        $this->withoutHeader('Expires');
        $date->setTimezone($timezone);
        $this->withHeader('Expires', $date->format('D, d M Y H:i:s') . ' GMT');

        $maxAge = $date->getTimestamp() - (new DateTime('now', $timezone))->getTimestamp();
        $this->withMaxAge($maxAge);

        return $this;
    }
public function withExpires ( DateTime $ date ) { $ timezone = new DateTimeZone ( "PRC" ) ; $ this -> withoutHeader ( 'Expires' ) ; $ date -> setTimezone ( $ timezone ) ; $ this -> withHeader ( 'Expires' , $ date -> format ( 'D, d M Y H:i:s' ) . ' GMT' ) ; $ maxAge = $ date -> getTimestamp ( ) - ( new DateTime ( 'now' , $ timezone ) ) -> getTimestamp ( ) ; $ this -> withMaxAge ( $ maxAge ) ; return $ this ; }
Sets the Expires HTTP header with a DateTime instance.

Passing null as value will remove the header.

@param DateTime|null $date A \DateTime instance or null to remove the header

@return $this
Sets the Expires HTTP header with a DateTime instance .