|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2009-05-10 17:29 UTC] 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.
Patchesbug48225 (last revision 2016-08-07 14:10 UTC by cmb@php.net)Pull Requests
Pull requests:
HistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sun Oct 26 01:00:01 2025 UTC |
OS: Slackware 13.37 $ php -v PHP 5.3.8 (cli) (built: Oct 9 2011 13:58:17) Copyright (c) 1997-2011 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies with Xdebug v2.1.1, Copyright (c) 2002-2011, by Derick Rethans still has this bug, the "u" part is still at 000000.