php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79400 PHP does not parse postgres ISO or RFC date times
Submitted: 2020-03-20 20:53 UTC Modified: 2020-03-29 04:22 UTC
From: ce dot ceo at cybercoment dot com Assigned:
Status: No Feedback Package: Date/time related
PHP Version: 7.4.4 OS: alpine
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2020-03-20 20:53 UTC] 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")


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2020-03-20 22:12 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2020-03-20 22:12 UTC] requinix@php.net
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.
 [2020-03-29 04:22 UTC] php-bugs at lists dot php dot net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Dec 07 05:03:41 2021 UTC