php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #27551 strtotime fails to parse ISO 8601 timestamps with fractional seconds
Submitted: 2004-03-10 11:27 UTC Modified: 2004-03-11 12:37 UTC
From: daniele at orlandi dot com Assigned:
Status: Closed Package: Date/time related
PHP Version: 4.3.5RC3 OS: SuSE Linux 9.0
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: daniele at orlandi dot com
New email:
PHP Version: OS:

 

 [2004-03-10 11:27 UTC] daniele at orlandi dot com
Description:
------------
strtotime fails to parse timestamp returned by PostgreSQL in the default ISO 8601 output due to fractional seconds.

This time stamp is not parsed (invalid):

 2004-03-10 16:33:17.11403+01

This is correctly parsed:

 2004-03-10 16:33:17+01

Fractional part could be ignored but shouldn't make strtotime consider the timestamp as invalid.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-03-10 13:27 UTC] sniper@php.net
Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves. 

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external 
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try avoid embedding huge scripts into the report.


 [2004-03-11 12:13 UTC] daniele at orlandi dot com
Mmmh... do you really need an example script to test a function for two given values? :)
Well... here is it:

<?
  echo "2004-03-11 18:16:07.755155+01 = "
      .strtotime("2004-03-11 18:16:07.755155+01")
      ."<br />";

  echo "2004-03-11 18:16:07+01 = "
      .strtotime("2004-03-11 18:16:07+01")
      ."<br />";
?>

Result:

2004-03-11 18:16:07.755155+01 = -1
2004-03-11 18:16:07+01 = 1079025367

Expected result:

2004-03-11 18:16:07.755155+01 = 1079025367
2004-03-11 18:16:07+01 = 1079025367
 [2004-03-11 12:37 UTC] derick@php.net
This is already fixed (Added) in PHP 5, but as we classify it as a new feature we will not merge it back to PHP 4.3.

regards,
Derick
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu May 02 23:01:30 2024 UTC