|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2017-06-13 09:20 UTC] iyeo at ya dot ru
Description:
------------
Function date_format($now, "Y-m-d\TH:m:s.v") returns "1000" milliseconds after "999", but it must be a "000".
Test script:
---------------
<?php
for ($i = 0; $i < 3000; $i++) {
$now = new DateTime();
$t = date_format($now, "Y-m-d\TH:m:s.v");
echo $t . "<br>";
}
?>
Expected result:
----------------
2017-06-13T11:06:22.998
2017-06-13T11:06:22.999
2017-06-13T11:06:23.000
Actual result:
--------------
2017-06-13T11:06:22.998
2017-06-13T11:06:22.999
2017-06-13T11:06:22.1000
2017-06-13T11:06:23.000
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Nov 01 03:00:01 2025 UTC |
This appears to be fixed as of PHP 7.2.0rc1. Example script: $dateTime = new \DateTime('2017-09-29 17:44:48.999600'); var_dump($dateTime->format('Y-m-d H:i:s.v')); Output for 7.0.0 to 7.2.0beta3: string(24) "2017-09-29 17:44:48.1000" Output for 7.2.0rc1 to 7.2.0rc2: string(23) "2017-09-29 17:44:48.999"