|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-09-04 14:55 UTC] derick@php.net
[2020-09-04 14:55 UTC] derick@php.net
-Status: Open
+Status: Closed
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 18:00:02 2025 UTC |
Description: ------------ The current time is not populated when a DateTime object is created by createFromFormat with a format pattern that has no time part defined. Given the following code: var_dump(DateTimeImmutable::createFromFormat('Y-m-d', '2020-09-04')); Output from 8.0.0beta2 and before: object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2020-09-04 10:28:48.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Output from 8.0.0beta3: object(DateTimeImmutable)#1 (3) { ["date"]=> string(26) "2020-09-04 00:00:00.000000" ["timezone_type"]=> int(3) ["timezone"]=> string(16) "Europe/Amsterdam" } Test script: --------------- <?php var_dump(DateTimeImmutable::createFromFormat('Y-m-d', '2020-09-04')->format('His') > 0); Expected result: ---------------- bool(true) Actual result: -------------- bool(false)