Bug #79400 [Opn->Fbk]: PHP does not parse postgres ISO or RFC date times
| From: | requinix@php.net | Date: | Fri, 20 Mar 2020 22:12:24 +0000 |
| Subject: | Bug #79400 [Opn->Fbk]: PHP does not parse postgres ISO or RFC date times | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-226194@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79400&edit=1
ID: 79400
Updated by: requinix@php.net
Reported by: ce dot ceo at cybercoment dot com
Summary: PHP does not parse postgres ISO or RFC date times
-Status: Open
+Status: Feedback
Type: Bug
Package: Date/time related
Operating System: alpine
PHP Version: 7.4.4
Block user comment: N
Private report: N
New Comment:
Is there any particular reason you have to use createFromFormat for this? True, there is no constant
that covers their ISO style,
https://www.postgresql.org/docs/9.1/datatype-datetime.html#DATATYPE-DATETIME-OUTPUT
nor a plain "Y-m-d H:i:s", but as you've seen with strtotime() regular parsing works
just fine.
Previous Comments:
------------------------------------------------------------------------
[2020-03-20 20:53:49] ce dot ceo at cybercoment dot com
Description:
------------
PHP 7.4.1
Postgres 11.6
None of the DateTime format strings successfully parse dates from Postgres's default
"ISO" format (Although postgres has its own bugs where they use a space instead of a
'T')
strtotime works but it's a timestamp instead of a datetime.
Test script:
---------------
DateTime::createFromFormat(DateTime::ISO8601, "2021-03-12 20:17:36.922347")
DateTime::createFromFormat(DateTime::RFC3339, "2021-03-12 20:17:36.922347")
DateTime::createFromFormat(DateTime::RFC3339_EXTENDED, "2021-03-12 20:17:36.922347")
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79400&edit=1