3v4l.org

run code in 500+ PHP versions simultaneously
<?php $date = new \DateTime(); $date->setTimeZone(new DateTimeZone('GMT')); //Wed, 20 Dec 2023 23:28:11 GMT echo $date->format(DATE_RFC7231)."\n"; $date->setTimeZone(new DateTimeZone('Europe/Tallinn')); //Thu, 21 Dec 2023 01:28:20 GMT echo $date->format(DATE_RFC7231);
Output for 8.5.0 - 8.5.3
Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in /in/5Oh7Z on line 5 Wed, 20 Dec 2023 23:52:59 GMT Deprecated: Constant DATE_RFC7231 is deprecated since 8.5, as this format ignores the associated timezone and always uses GMT in /in/5Oh7Z on line 7 Thu, 21 Dec 2023 01:52:59 GMT
Output for 8.1.0 - 8.1.34, 8.2.0 - 8.2.30, 8.3.0 - 8.3.30, 8.4.1 - 8.4.18
Wed, 20 Dec 2023 23:52:59 GMT Thu, 21 Dec 2023 01:52:59 GMT

preferences:
86.94 ms | 981 KiB | 4 Q