Bug->Req #69122 [Opn]: strtotime and DateTime fail to parse certain strings with fractional seconds
| From: | requinix@php.net | Date: | Thu, 26 Feb 2015 01:03:51 +0000 |
| Subject: | Bug->Req #69122 [Opn]: strtotime and DateTime fail to parse certain strings with fractional seconds | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-190953@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=69122&edit=1
ID: 69122
Updated by: requinix@php.net
Reported by: alexander dot minges at gmail dot com
Summary: strtotime and DateTime fail to parse certain strings
with fractional seconds
Status: Open
-Type: Bug
+Type: Feature/Change Request
Package: Date/time related
Operating System: Linux 3.18.7 x86_64 GNU/Lin
PHP Version: 5.6.6
Block user comment: N
Private report: N
New Comment:
The most it could do is ignore the microseconds.
Meanwhile
DateTime::createFromFormat("M d H:i:s.u Y T", "Feb 25 23:38:22.226 2015 GMT")
works fine.
Previous Comments:
------------------------------------------------------------------------
[2015-02-26 00:50:51] alexander dot minges at gmail dot com
Description:
------------
strtotime fails to parse strings in the format "Feb 25 23:38:22.226 2015 GMT" while
"Feb 25 23:38:22 2015 GMT" is parsed fine. The same applies to creating a DateTime object.
Test script:
---------------
<?php
//This works
echo strtotime("Feb 25 23:38:22 2015 GMT");
//This one does not
echo strtotime("Feb 25 23:38:22.226 2015 GMT");
?>
Expected result:
----------------
1424907502
1424907502
Actual result:
--------------
1424907502
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=69122&edit=1