note 125488 added to datetime.format
| From: | tuxedobob@php.net | Date: | Thu, 05 Nov 2020 13:49:01 +0000 |
| Subject: | note 125488 added to datetime.format | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-215813@lists.php.net to get a copy of this message | ||
I'm actually not sure whether this is a bug, but here's something that tripped me up on
PHP 7.3.
I have a date that looks like this: 'November 3, 2020 11:13 (CST)'
I tried to format it using this format string: 'F j, Y H:i (T)'
That didn't work.
What *did* work was the format string without the parentheses: 'F j, Y H:i T'.
This string also parsed the timezone when the time zone *didn't* have parentheses surrounding
it: 'November 3, 2020 11:13 CST'.
It seems as though the T token is a little greedy with surrounding parentheses, so don't
include them in your format string.
----
Server IP: 45.112.84.4
Probable Submitter: 185.85.3.174 (proxied: 73.17.222.207)
----
Manual Page -- http://php.net/manual/en/datetime.format.php
Edit -- https://master.php.net/note/edit/125488
Del: integrated -- https://master.php.net/note/delete/125488/integrated
Del: useless -- https://master.php.net/note/delete/125488/useless
Del: bad code -- https://master.php.net/note/delete/125488/bad+code
Del: spam -- https://master.php.net/note/delete/125488/spam
Del: non-english -- https://master.php.net/note/delete/125488/non-english
Del: in docs -- https://master.php.net/note/delete/125488/in+docs
Del: other reasons-- https://master.php.net/note/delete/125488
Reject -- https://master.php.net/note/reject/125488
Search -- https://master.php.net/manage/user-notes.php