|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2008-02-12 22:28 UTC] derick@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Dec 20 08:00:02 2025 UTC |
Description: ------------ using "date_create('@'.$timestamp)" ignores the default timezone setting, giving the timezone as second parameter does not work either. tested with 5.2.3-1ubuntu6.3, 5.2.0-8+etch10 and tested with snapshot: 5.3-200802121930 Reproduce code: --------------- $t= time(); $tz= date_default_timezone_get(); $d1= date_create(date("c", $t)); $d2= date_create("@$t"); // ignores default timezone $d3= date_create("@$t", new DateTimeZone($tz)); // ignores timezone too echo "default timezone: $tz\n"; echo $d1->format(DATE_RFC2822)."\n"; echo $d2->format(DATE_RFC2822)."\n"; echo $d3->format(DATE_RFC2822)."\n"; Expected result: ---------------- default timezone: Europe/Berlin Tue, 12 Feb 2008 22:11:23 +0100 Tue, 12 Feb 2008 22:11:23 +0100 Tue, 12 Feb 2008 22:11:23 +0100 Actual result: -------------- default timezone: Europe/Berlin Tue, 12 Feb 2008 22:11:23 +0100 Tue, 12 Feb 2008 21:11:23 +0000 Tue, 12 Feb 2008 21:11:23 +0000