php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #68569 Datetime microseconds precision loss
Submitted: 2014-12-08 15:16 UTC Modified: 2016-06-26 04:22 UTC
Votes:2
Avg. Score:4.0 ± 1.0
Reproduced:0 of 0 (0.0%)
From: jenson at axis dot com Assigned: cmb (profile)
Status: No Feedback Package: Date/time related
PHP Version: 5.4.35 OS: Debian
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: jenson at axis dot com
New email:
PHP Version: OS:

 

 [2014-12-08 15:16 UTC] jenson at axis dot com
Description:
------------
---
From manual page: http://www.php.net/class.datetime
---
When creating a DateTime object from ISO string (ie 2014-11-28T12:39:36.257642Z) the microseconds returned by format('u') differ from microseconds in the timestring for certain strings.

Test script:
---------------
$t = "2014-11-28T12:39:36.257642Z";
$d = new DateTime($t);
echo "Input:  " . $t . "\n";
echo "Microseconds from datetime: ". $d->format('u'); // ends in 1

Expected result:
----------------
$t = "2014-11-28T12:39:36.257641Z";
$d = new DateTime($t);
echo "Input:  " . $t . "\n";
echo "Microseconds from datetime: ". $d->format('u'); // Correct


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2016-06-14 11:09 UTC] cmb@php.net
-Status: Open +Status: Feedback
 [2016-06-14 11:09 UTC] cmb@php.net
Hm, I can't reproduce this behavior, see <https://3v4l.org/MNSPn>.
Do you still face this issue? And I wonder why you have filed this
as doc bug.
 [2016-06-15 00:09 UTC] cmb@php.net
-Assigned To: +Assigned To: cmb
 [2016-06-26 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-2024 The PHP Group
All rights reserved.
Last updated: Thu Mar 28 13:01:28 2024 UTC