|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2012-08-01 08:36 UTC] salathe@php.net
[2012-08-01 08:36 UTC] salathe@php.net
-Status: Open
+Status: Not a bug
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Dec 11 05:00:02 2025 UTC |
Description: ------------ I thought these two commands are equal: DateTime::createFromFormat('U', 1343730289, new DateTimeZone("Europe/Prague")) DateTime::createFromFormat('U', 1343730289)->setTimeZone(new DateTimeZone("Europe/Prague")) However they aren't. If that behaviour is correct (I'm unsure) can you explain why are they different? Test script: --------------- var_export( DateTime::createFromFormat('U', 1343730289)->setTimeZone(new DateTimeZone("Europe/Prague"))->getTimeZone()->getName() === DateTime::createFromFormat('U', 1343730289, new DateTimeZone("Europe/Prague"))->getTimeZone()->getName() ); Expected result: ---------------- true Actual result: -------------- false