Re: switching between timezones?

From: Date: Mon, 08 Jan 2001 05:46:45 +0000
Subject: Re: switching between timezones?
References: 1  Groups: php.dev 
Request: Send a blank email to php-dev+get-43316@lists.php.net to get a copy of this message
I noticed a similar/same problem, and found a possible workaround - make an abitrary call to mktime() after your putenv("TZ=..."). It seems to "activate" the timezone change. putenv("TZ=Greenwich"); mktime(0,0,0,1,1,1970); echo date("H"); "Seth Northrop" <seth@calculon.northrops.com> wrote in message news:Pine.LNX.4.21.0101072022100.29136-100000@calculon.northrops.com... > > I noticed that there are still issues with switching between > timezones. Is this a bug? And, if so is there any indication when it > might be fixed. > > 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 > > Any ideas? > Seth > > > > > > -- > PHP Development Mailing List <http://www.php.net/> > To unsubscribe, e-mail: php-dev-unsubscribe@lists.php.net > For additional commands, e-mail: php-dev-help@lists.php.net > To contact the list administrators, e-mail: php-list-admin@lists.php.net >

« previous php.dev (#43316) next »