@@ -443,7 +443,7 @@ $app->get('/user', function (Psr\Http\Message\ServerRequestInterface $request) {
443443<h1 >Hello Alice</h1 >
444444HTML;
445445
446- $modified = $date->setTimezone(new DateTimeZone('UTC'))->format(DATE_RFC7231 );
446+ $modified = gmdate('D, d M Y H:i:s T', $date->getTimestamp() );
447447 if ($request->getHeaderLine('If-Modified-Since') === $modified) {
448448 return new React\Http\Message\Response(
449449 React\Http\Message\Response::STATUS_NOT_MODIFIED,
@@ -481,11 +481,19 @@ Last-Modified: Sat, 06 Nov 2021 12:31:04 GMT
481481
482482> ℹ️ ** Working with dates**
483483>
484- > For use in HTTP, you may format any date in the GMT/UTC timezone using the
485- > [ ` DATE_RFC7231 ` ] ( https://www.php.net/manual/en/class.datetimeinterface.php#datetime.constants.rfc7231 )
486- > (PHP 7.1.5+) constant as given above. If you don't know the modification date
487- > for your response or don't want to expose this information, you may want to
488- > use [ ` ETag ` ] ( #etag ) headers from the previous section instead.
484+ > For use in HTTP, you may format any date using the GMT time zone and the exact
485+ > format as given above. While UTC and GMT are often used interchangeably, the
486+ > HTTP specs require dates to be formatted in GMT.
487+ >
488+ > ``` php
489+ > // convert date to GMT first, both forms are equivalent
490+ > $modified = gmdate('D, d M Y H:i:s T', $date->getTimestamp());
491+ > $modified = $date->setTimezone(new DateTimeZone('GMT'))->format('D, d M Y H:i:s T');
492+ > ```
493+ >
494+ > If you don't know the modification date for your response or don't want to
495+ > expose this information, you may want to use [`ETag`](#etag) headers from the
496+ > previous section instead.
489497
490498## Output buffering
491499
0 commit comments