|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2016-01-16 04:54 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2016-01-16 04:54 UTC] requinix@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Wed Oct 29 00:00:01 2025 UTC |
Description: ------------ When you run the script method format returns different date than was reported in the __construct Test script: --------------- 1º Case <?php date_default_timezone_set('America/Sao_Paulo'); $date = new \DateTime('01/02/2016'); var_dump($date->format('d/m/Y')); ?> 2º Case <?php date_default_timezone_set('America/Sao_Paulo'); $date = new \DateTime('01/02/2016'); var_dump($date); ?> Expected result: ---------------- 1º Case string(10) "01/02/2016" 2º Case class DateTime#1 (3) { public $date => string(26) "2016-02-01 00:00:00.000000" public $timezone_type => int(3) public $timezone => string(17) "America/Sao_Paulo" } Actual result: -------------- 1º Case 02/01/2016 2º Case Displays the following result class DateTime#1 (3) { public $date => string(26) "2016-01-02 00:00:00.000000" public $timezone_type => int(3) public $timezone => string(17) "America/Sao_Paulo" }