note 129762 added to datetime.formats
| From: | Anonymous | Date: | Mon, 23 Sep 2024 15:11:50 +0000 |
| Subject: | note 129762 added to datetime.formats | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-221546@lists.php.net to get a copy of this message | ||
I wrote previously that appending a 'T' to a year forces PHP to interpret the date as a
year rather than a time. This does not appear to be universally true. While this method did work for
me in my previous development environment (PHP 8.1 on Ubuntu 20.04), it does not work after
upgrading my development environment (PHP 8.3 on Ubuntu 24.04). The 'T' is instead seen as
a timezone.
Further testing shows that PHP 8.1 (and even earlier PHP versions) also have this new behavior I am
observing. Therefore, I can only assume the behavior is dependent on environment and/or build rather
than PHP version.
The suggestion about adding an actual time string to the year, e.g. '00:00 2004', is still
valid. This appears to be the only reliable way to force PHP to interpret a string as a date rather
than a datetime.
----
Server IP: 45.112.84.4
Probable Submitter: 45.112.84.18 (proxied: 163.116.147.39)
----
Manual Page -- https://php.net/manual/en/datetime.formats.php
Edit -- https://main.php.net/note/edit/129762
Del: integrated -- https://main.php.net/note/delete/129762/integrated
Del: useless -- https://main.php.net/note/delete/129762/useless
Del: bad code -- https://main.php.net/note/delete/129762/bad+code
Del: spam -- https://main.php.net/note/delete/129762/spam
Del: non-english -- https://main.php.net/note/delete/129762/non-english
Del: in docs -- https://main.php.net/note/delete/129762/in+docs
Del: other reasons-- https://main.php.net/note/delete/129762
Reject -- https://main.php.net/note/reject/129762
Search -- https://main.php.net/manage/user-notes.php