Timezone troubles in PHP4
| From: | Willem Bison | Date: | Sun, 15 Oct 2000 01:24:56 +0000 |
| Subject: | Timezone troubles in PHP4 | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-20183@lists.php.net to get a copy of this message | ||
I'm gaving trouble switching timezones within one PHP4 script:
$t = time();
// Switch to Amsterdam time (gmt+2)
putenv("TZ=Europe/Amsterdam");
echo date("H:i",$t)."<br>";
// Switch to London time (gmt+1)
putenv("TZ=Europe/London");
echo date("H:i",$t)."<br>";
// Switch back to Amsterdam time (gmt+2)
putenv("TZ=Europe/Amsterdam");
echo date("H:i",$t);
this outputs:
03:08
03:08
03:08
The second line should be 02:08.
Just setting a timezone once works fine.
I did not have these problems in any PHP3 version on the same machine and
same Apache/Linux versions.
I'm running PHP4.0.3, Apache 1.3.12, Linux rh.