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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
MUST BE VALID
Solve the problem:
45 - 43 = ?
Subscribe to this entry?

 
 [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: Fri Apr 26 11:01:31 2024 UTC