php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #52514 microseconds are missing in DateTime class
Submitted: 2010-08-02 13:44 UTC Modified: 2016-10-07 17:40 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: giorgio dot liscio at email dot it Assigned: derick (profile)
Status: Closed Package: Date/time related
PHP Version: 5.3.3 OS: all? xp x64
Private report: No CVE-ID: None
 [2010-08-02 13:44 UTC] giorgio dot liscio at email dot it
Description:
------------
hi

i expected to dump microseconds too when i use

new DateTime("now");
new DateTime(date('Y-m-d H:i:s.283020,time()));

but apparently they are not stored at all in datetime objects

echo date('Y-m-d H:i:s.u',microtime(true));

or in classical php functions

thank you


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2010-08-07 00:38 UTC] felipe@php.net
-Status: Open +Status: Assigned -Assigned To: +Assigned To: derick
 [2010-08-07 02:45 UTC] giorgio dot liscio at email dot it
hi, thank you for accepting this bug

microseconds must be stored for example in:

"now"
"+5 weeks"
"-7 weekdays"
"ago"

in practice, when the date-time is relative to "now"

in plus must works (and apparently works) full microseconds support when datetime is instantiated through createFromFormat()

see http://bugs.php.net/bug.php?id=52519 too

thank you for creating this library, love oop dates :)
 [2011-01-22 08:50 UTC] stas@php.net
-Type: Bug +Type: Feature/Change Request
 [2016-10-05 20:03 UTC] derick@php.net
The issue from the title is fixed for PHP 7.1.0 RC4, but you can't use "ms" or the like with DateTime->modify yet.
 [2016-10-07 17:40 UTC] derick@php.net
-Status: Assigned +Status: Closed
 [2016-10-07 17:40 UTC] derick@php.net
The fix for this bug has been committed.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.

 For Windows:

http://windows.php.net/snapshots/
 
Thank you for the report, and for helping us make PHP better.

Fixed for PHP 7.1.0RC4.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 16:01:28 2024 UTC