|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2001-01-09 04:05 UTC] sniper@php.net
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 16:00:01 2025 UTC |
I noticed that there are still issues with switching between timezones. For example, given the following: <? # foo.php putenv("TZ=Greenwich"); echo date("H")."\n"; putenv("TZ=US/Central"); echo date("H")."\n"; putenv("TZ=Greenwich"); echo date("H")."\n"; ?> $./php3 foo.php Content-type: text/html 03 21 03 $./php4 foo.php X-Powered-By: PHP/4.0.1pl2 Content-type: text/html 03 03 03 $./php4.4 foo.php X-Powered-By: PHP/4.0.4 Content-type: text/html 03 03 03 Notice it worked in php3, but is failing within PHP 4 (including 4.0.4). Also notice that the first switch usually works; though, I've even noticed where the first putenv fails and the script stays within the local timezone. I also noticed there has been previous discussion (but no response?) on the topic: http://marc.theaimsgroup.com/?l=php-general&m=97666005518422&w=2 http://marc.theaimsgroup.com/?l=php-general&m=97157283226980&w=2 Finally, it APPEARS that calling mktime after the putenv in 4.0.x seems to cause the putenv to work. (ie, it seems to activate the TZ change). Absent a mktime, it stays in the local timezone.