|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74332 DateTime::createFromFormat(date) adds current time; but no microseconds
Submitted: 2017-03-29 12:38 UTC Modified: 2017-03-30 13:14 UTC
Avg. Score:3.5 ± 0.9
Reproduced:3 of 3 (100.0%)
Same Version:2 (66.7%)
Same OS:1 (33.3%)
From: sjon at hortensius dot net Assigned: derick (profile)
Status: Assigned Package: Date/time related
PHP Version: 7.1.3 OS:
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2017-03-29 12:38 UTC] sjon at hortensius dot net
"If format does not contain the character ! then portions of the generated time which are not specified in format will be set to the current system time. "

Given that all datetime methods now include microseconds, DateTime::createFromFormat should do this as well

Test script:
var_dump(DateTime::createFromFormat('Y-m-d', '1980-01-01')->format('H:i:s.u'));

Expected result:
string(15) "14:35:58.283437"

Actual result:
string(15) "14:35:58.000000"


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-30 13:14 UTC]
-Assigned To: +Assigned To: derick
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Fri Aug 06 02:01:24 2021 UTC