|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-09-13 16:12 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-09-13 16:12 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2026 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 07 17:00:02 2026 UTC |
Description: ------------ ---versions--- 5.6.25、7.0.6 ---Description--- public static DateTime DateTime::createFromFormat ( string $format , string $time [, DateTimeZone $timezone = date_default_timezone_get() ] ) When format option contain a microsecond string like 'U.u', the tiemzone option is invalid. Test script: --------------- <?php $timezone = new \DateTimeZone('PRC'); $now = DateTime::createFromFormat('U.u', number_format(microtime(true), 6, '.', ''), $timezone); print_r($now); $now->setTimezone($timezone); print_r($now); ?> Expected result: ---------------- two results should be equal Actual result: -------------- Two results are not equal DateTime Object ( [date] => 2016-09-13 15:55:50.946395 [timezone_type] => 1 [timezone] => +00:00 ) DateTime Object ( [date] => 2016-09-13 23:55:50.946395 [timezone_type] => 3 [timezone] => PRC )