Edit report at http://bugs.php.net/bug.php?id=41806&edit=1
ID: 41806
Comment by: somemail at gmail dot com
Reported by: lordi at msdi dot ca
Summary: milliseconds in date function
Status: Bogus
Type: Bug
Package: Date/time related
Operating System: FreeBSD 6.2-RELEASE
PHP Version: 5.2.3
Assigned To: derick
Block user comment: N
Private report: N
New Comment:
The problem still exists (Debian, PHP 5.2.6-1), even though the example
wasn't good enough.
Reproduce code:
---------------------------
echo date('H:i:s.u', microtime(true));
echo microtime(true);
Expected:
---------------------------
20:15:44.380000
1297880144.38
Actual:
---------------------------
20:15:44.000000
1297880144.38
Previous Comments:
------------------------------------------------------------------------
[2007-07-12 19:04:50] [email protected]
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to report
a bug at http://bugs.php.net/how-to-report.php
This is correct, it states that the timestamp is an integer, and that it
defaults to the value of "time()" in the documentation. time() does not
return a float with fractions of a second:
http://no.php.net/date:
Returns a string formatted according to the given format string using
the given integer timestamp or the current time if no timestamp is
given. In other words, timestamp is optional and defaults to the value
of time().
------------------------------------------------------------------------
[2007-06-26 00:27:39] [email protected]
I think someone forgot to commit the part to the ext/date/lib/ side of
things when adding 'u' format as I can't see anywhere where t->f would
be set to anything but 0..
------------------------------------------------------------------------
[2007-06-25 23:53:12] lordi at msdi dot ca
Description:
------------
Hi,
the "u" parameters in the date function should return milliseconds, but
it always returns zeros.
Reproduce code:
---------------
date_default_timezone_set('America/Montreal');
echo date ('H:i:s:u');
Expected result:
----------------
19:50:39:123456
Actual result:
--------------
19:50:39:000000
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/bug.php?id=41806&edit=1