php.net |  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
Votes:3
Avg. Score:3.0 ± 0.0
Reproduced:2 of 2 (100.0%)
Same Version:1 (50.0%)
Same OS:1 (50.0%)
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
Description:
------------
"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"

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-03-30 13:14 UTC] derick@php.net
-Assigned To: +Assigned To: derick
 
PHP Copyright © 2001-2017 The PHP Group
All rights reserved.
Last updated: Sun Nov 19 01:31:42 2017 UTC