#48225 [Ver->Asn]: Microseconds output wrong in DateTime::format()
| From: | jani@php.net | Date: | Sun, 10 May 2009 17:38:56 +0000 |
| Subject: | #48225 [Ver->Asn]: Microseconds output wrong in DateTime::format() | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-137126@lists.php.net to get a copy of this message | ||
ID: 48225
Updated by: jani@php.net
Reported By: knut dot urdalen at gmail dot com
-Status: Verified
+Status: Assigned
Bug Type: Date/time related
Operating System: *
PHP Version: 5.*, 6CVS (2009-05-09)
-Assigned To:
+Assigned To: derick
New Comment:
See also bug #45554 and bug #47312
Previous Comments:
------------------------------------------------------------------------
[2009-05-10 17:29:54] knut dot urdalen at gmail dot com
Description:
------------
The date()-function allow a 'u' format character in the formatting
field as of PHP 5.2.2. The DateTime::format() function point to the same
manual page for the formatting as the date() function and since DateTime
actually store microseconds internally (as mentioned by Derick
previously) I think it's a bug that it's not output correctly.
Reproduce code:
---------------
<?php
date_default_timezone_set('Europe/Oslo');
$datetime = new DateTime();
echo $datetime->format('Y-m-d H:i:s.u')."\n";
?>
Expected result:
----------------
The 'u' format character should output the microsecond that is
internally stored in the DateTime object upon creation.
Actual result:
--------------
The 'u' format character always resolve to 00000.
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=48225&edit=1