note 10140 modified in date by ronabop
| From: | ronabop@php.net | Date: | Tue, 19 Dec 2000 05:08:45 +0000 |
| Subject: | note 10140 modified in date by ronabop | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-8885@lists.php.net to get a copy of this message | ||
PHP4 and timezone. Need to discard first read
and print second.
Like so:
function showtime($tz,$t)
{
putenv("TZ=$tz");
$wrong = strftime("%c",$t);
$right = strftime("%c",$t);
print "Timezone: $tz<br>Wrong: $wrong<br>Right:
$right<br><hr>\n";
}
$t=gmmktime(0,0,0,12,01,2000);
showtime("Australia/Adelaide",$t);
showtime("Europe/Riga",$t);
showtime("Europe/London",$t);
showtime("Australia/Melbourne",$t);
?>
Displays:
Timezone: Australia/Adelaide
Wrong: Fri Dec 1 02:00:00 2000
Right: Fri Dec 1 10:30:00 2000
Timezone: Europe/Riga
Wrong: Fri Dec 1 10:30:00 2000
Right: Fri Dec 1 02:00:00 2000
Timezone: Europe/London
Wrong: Fri Dec 1 02:00:00 2000
Right: Fri Dec 1 00:00:00 2000
Timezone: Australia/Melbourne
Wrong: Fri Dec 1 00:00:00 2000
Right: Fri Dec 1 11:00:00 2000
http://www.php.net/manual/function.date.php