php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Doc Bug #44286 date('u'): milli or microseconds?
Submitted: 2008-02-28 20:21 UTC Modified: 2008-08-27 18:08 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: carsten at bitbybit dot dk Assigned:
Status: Closed Package: Documentation problem
PHP Version: Irrelevant OS: any
Private report: No CVE-ID: None
 [2008-02-28 20:21 UTC] carsten at bitbybit dot dk
Description:
------------
According to current documentation, date('u') returns "Milliseconds (added in PHP 5.2.2) | Example: 54321".

I suspect that what is meant is microseconds (10^-6 s), not milliseconds (10^-3 s). Otherwise, the example value doesn't make sense.

Reproduce code:
---------------
shell> php -r 'echo date("u")."\n".date("u")."\n";'


Expected result:
----------------
microseconds, not milliseconds

Actual result:
--------------
microseconds (apparently)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2008-08-27 18:06 UTC] ross dot masters dot rm at googlemail dot com
The source (below)

case 'u': length = date_spprintf(&buffer, 32 TSRMLS_CC, "%06d", (int) floor(t->f * 1000000)); break;

Which is 10^-6 - microseconds.

I don't have a CVS account but here's a small docbook patch for it:


Index: phpdoc/en/reference/datetime/functions/date.xml
--- phpdoc/en/reference/datetime/functions/date.xml Base (1.42)
+++ phpdoc/en/reference/datetime/functions/date.xml Locally Modified (Based On 1.42)
@@ -214,7 +214,7 @@
           </row>
           <row>
            <entry><literal>u</literal></entry>
-           <entry>Milliseconds (added in PHP 5.2.2)</entry>
+           <entry>Microseconds (added in PHP 5.2.2)</entry>
            <entry>Example: <literal>54321</literal></entry>
           </row>
           <row>
 [2008-08-27 18:08 UTC] kalle@php.net
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: Fri Apr 26 19:01:29 2024 UTC