Bug->Req #76218 [Nab->Opn]: DateTime::createFromFormat should support 'v' (milliseconds)
| From: | requinix@php.net | Date: | Fri, 13 Apr 2018 14:13:28 +0000 |
| Subject: | Bug->Req #76218 [Nab->Opn]: DateTime::createFromFormat should support 'v' (milliseconds) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-214732@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=76218&edit=1
ID: 76218
Updated by: requinix@php.net
Reported by: giacomo dot pinato at gmail dot com
-Summary: Format DATE_RFC3339_EXTENDED fails to match valid
input
+Summary: DateTime::createFromFormat should support 'v'
(milliseconds)
-Status: Not a bug
+Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Date/time related
Operating System: MacOS
PHP Version: 7.2.4
Block user comment: N
Private report: N
Previous Comments:
------------------------------------------------------------------------
[2018-04-13 14:12:10] requinix@php.net
The format string is "Y-m-d\TH:i:s.vP". I do not see 'v' listed as supported in
the docs for createFromFormat.
Use DateTime::getLastErrors() to see the warnings.
What example did you see with that code?
------------------------------------------------------------------------
[2018-04-13 14:02:33] giacomo dot pinato at gmail dot com
Description:
------------
The DateTime class fails to correctly instantiate with the DATE_RFC3339_EXTENDED when input data is
correct.
The example in this bug is taken directly from the documentation at http://php.net/manual/en/class.datetime.php
Test script:
---------------
<?php
$willBeFalse = DateTime::createFromFormat(DATE_RFC3339_EXTENDED,
'2005-08-15T15:52:01.000+00:00');
$willAlsoBeFalse = DateTimeImmutable::createFromFormat(DATE_RFC3339_EXTENDED,
'2005-08-15T15:52:01.000+00:00');
$date = new DateTime();
$shouldNotBeFalse = DateTime::createFromFormat(DATE_RFC3339_EXTENDED,
$date->format(DATE_RFC3339_EXTENDED));
var_dump($shouldNotBeFalse); // false
Expected result:
----------------
The two objects should get instantiated correctly
Actual result:
--------------
$willBeFalse and $willAlsoBeFalse are false
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=76218&edit=1