note 127924 added to class.datetimeinterface
| From: | bohwaz at main dot php dot net | Date: | Sun, 13 Nov 2022 23:22:22 +0000 |
| Subject: | note 127924 added to class.datetimeinterface | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-219879@lists.php.net to get a copy of this message | ||
Please note that if you are using DATE_RFC7231 format (used in HTTP/1.1), you'll need to change
the DateTime object timezone to GMT *before*, or you'll encounter weird results, as this format
DOES NOT convert the date to GMT.
So if you have a DateTime object using UTC+01:00 as its timezone, you will get a difference of 1
hour between your resulting date string and what should be the "correct" date.
Recommended use:
<?php
$date_gmt = clone $date;
$date_gmt->setTimezone(new \DateTimeZone('GMT'));
echo $date_gmt->format(DATE_RFC7231);
?>
----
Server IP: 45.112.84.4
Probable Submitter: 45.91.159.161 (proxied: 93.23.17.127)
----
Manual Page -- https://php.net/manual/en/class.datetimeinterface.php
Edit -- https://main.php.net/note/edit/127924
Del: integrated -- https://main.php.net/note/delete/127924/integrated
Del: useless -- https://main.php.net/note/delete/127924/useless
Del: bad code -- https://main.php.net/note/delete/127924/bad+code
Del: spam -- https://main.php.net/note/delete/127924/spam
Del: non-english -- https://main.php.net/note/delete/127924/non-english
Del: in docs -- https://main.php.net/note/delete/127924/in+docs
Del: other reasons-- https://main.php.net/note/delete/127924
Reject -- https://main.php.net/note/reject/127924
Search -- https://main.php.net/manage/user-notes.php