Bug #75995 [Opn->Dup]: Date "v" format returns 4 digits for milliseconds

From: Date: Thu, 22 Feb 2018 14:36:49 +0000
Subject: Bug #75995 [Opn->Dup]: Date "v" format returns 4 digits for milliseconds
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214071@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75995&edit=1 ID: 75995 Updated by: requinix@php.net Reported by: lazaros at lazosweb dot com Summary: Date "v" format returns 4 digits for milliseconds -Status: Open +Status: Duplicate Type: Bug Package: Date/time related Operating System: Ubuntu PHP Version: 7.1.14 Block user comment: N Private report: N New Comment: Duplicate of bug #74753. Fixed in PHP 7.2 and last I knew couldn't be backported to 7.1. Previous Comments: ------------------------------------------------------------------------ [2018-02-22 14:27:48] lazaros at lazosweb dot com Fixing title name ------------------------------------------------------------------------ [2018-02-22 14:25:22] lazaros at lazosweb dot com Description: ------------ If you keep running my script you will see that once your reach 999 milliseconds the next millisecond wont be 000 but it will be 1000 which is wrong. This affects SQL Datetime which requires 3 digits for milliseconds. Once you send to SQL datetime a value like that 2018-02-22 15:15:15.1000 it will fail. Test script: --------------- for($i=1; $i <= 50000; $i++) { $date = new \DateTime(); echo($date->format('Y-m-d H:i:s.v').'<br />'); } Expected result: ---------------- Date format v should return a value from 000 to 999. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=75995&edit=1

« previous php.bugs (#214071) next »