|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[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)
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 00:00:02 2025 UTC |
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>