|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #69789 date() documentation regarding microseconds in misleading
Submitted: 2015-06-09 20:17 UTC Modified: 2015-06-16 20:47 UTC
From: patrick dot schwisow at gmail dot com Assigned: cmb (profile)
Status: Closed Package: Date/time related
PHP Version: Irrelevant OS:
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.
Block user comment
Status: Assign to:
Bug Type:
From: patrick dot schwisow at gmail dot com
New email:
PHP Version: OS:


 [2015-06-09 20:17 UTC] patrick dot schwisow at gmail dot com
On, 'u' is defined as:

"Microseconds (added in PHP 5.2.2). Note that date() will always generate 000000 since it takes an integer parameter, whereas DateTime::format() does support microseconds."

While this is not incorrect, it would lead you to believe that most DateTime objects will return microseconds. However, prevents this from working properly without a workaround.


doc-bug-69789.patch (last revision 2015-06-16 18:48 UTC by patrick dot schwisow at gmail dot com)

Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-06-10 19:36 UTC]
It's a shame that creating DateTime objects with microsecond resolution is as hard as it is, so it probably is worth noting this at the point where you'd generally want to use them. Good job!

Some feedback on the patch itself (none of this is bad; more just a reflection of our norms for the manual — coding style, if you will):

- It's rare that we directly reference bug reports in the manual (in fact, there's only one reference page that does so at present, and that one's probably wrong). I don't mind noting that it's harder than it should be to create a DateTime with microseconds and describing how to do so, but we probably don't need a link to the bug report as such.

- If the reference does stay in, the usual format would be to link using an entity for the base: this would be something like
<link xlink:href="&url.php.bugs;49779">#49779</link>. In general, we never place direct URLs in the manual, as this makes it harder for translators: genuinely new URLs (which this isn't, of course, as we have url.php.bugs already) go into doc-base/entities/global.ent and are then referenced from the reference page(s) that need them.

- Class names should be surrounded by <classname>, so <classname>DateTime</classname> — this is for both formatting and linking reasons.
 [2015-06-16 20:47 UTC]
-Status: Open +Status: Closed -Package: Documentation problem +Package: Date/time related -Assigned To: +Assigned To: cmb
 [2015-06-16 20:47 UTC]
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.

Thank you for the report, and for helping us make our documentation better.
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 14 23:01:27 2024 UTC