Bug #74753 [Opn->Ver]: Function "date_format()" displays "1000" milliseconds after "999"

From: Date: Tue, 13 Jun 2017 09:52:36 +0000
Subject: Bug #74753 [Opn->Ver]: Function "date_format()" displays "1000" milliseconds after "999"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209514@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74753&edit=1 ID: 74753 Updated by: requinix@php.net Reported by: iyeo at ya dot ru Summary: Function "date_format()" displays "1000" milliseconds after "999" -Status: Open +Status: Verified Type: Bug -Package: *General Issues +Package: Date/time related Operating System: (x64):Windows 8.1, Xubuntu 16.04 PHP Version: 7.1.6 Block user comment: N Private report: N New Comment: Due to the rounding also being done this will happen for microseconds >= 0.999500. https://3v4l.org/NNDZV Previous Comments: ------------------------------------------------------------------------ [2017-06-13 09:20:22] 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 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=74753&edit=1

« previous php.bugs (#209514) next »