|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2018-02-22 14:27 UTC] lazaros at lazosweb dot com
-Summary: Miliseconds return 4 digits until 3
+Summary: Date "v" format returns 4 digits for milliseconds
[2018-02-22 14:27 UTC] lazaros at lazosweb dot com
[2018-02-22 14:36 UTC] requinix@php.net
-Status: Open
+Status: Duplicate
[2018-02-22 14:36 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Nov 05 09:00:01 2025 UTC |
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.