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

From: Date: Tue, 13 Jun 2017 10:16:43 +0000
Subject: Bug #74753 [Ver->Asn]: Function "date_format()" displays "1000" milliseconds after "999"
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209515@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: derick@php.net Reported by: iyeo at ya dot ru Summary: Function "date_format()" displays "1000" milliseconds after "999" -Status: Verified +Status: Assigned Type: Bug Package: Date/time related Operating System: (x64):Windows 8.1, Xubuntu 16.04 PHP Version: 7.1.6 -Assigned To: +Assigned To: derick Block user comment: N Private report: N Previous Comments: ------------------------------------------------------------------------ [2017-06-13 09:52:36] requinix@php.net Due to the rounding also being done this will happen for microseconds >= 0.999500. https://3v4l.org/NNDZV ------------------------------------------------------------------------ [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 (#209515) next »