note 108793 added to function.date-default-timezone-set
| From: | StephanRudlof | Date: | Fri, 25 May 2012 02:26:58 +0000 |
| Subject: | note 108793 added to function.date-default-timezone-set | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-188214@lists.php.net to get a copy of this message | ||
Problem with the table above: timezone offset from Javascript contains summertime offset, but php
wants to have geographic timezone without summertime derivation (seems to compute it itself).
Here is an alternative, which works for me (summertime in Germany):
<?php
/* May fail for timezones not 'Etc/GMT*' (if they are summertime). */
$zonelist = array('Etc/GMT+12' => -12.00, 'Etc/GMT+11' => -11.00,
'Etc/GMT+10' => -10.00, 'Etc/GMT+9' => -9.00, 'Etc/GMT+8' =>
-8.00, 'Etc/GMT+7' => -7.00, 'Etc/GMT+6' => -6.00, 'Etc/GMT+5'
=> -5.00, 'America/Caracas' => -4.30, 'Etc/GMT+4' => -4.00,
'America/St_Johns' => -3.30, 'Etc/GMT+3' => -3.00, 'Etc/GMT+2'
=> -2.00, 'Etc/GMT+1' => -1.00, 'Etc/GMT' => 0, 'Etc/GMT-1'
=> 1.00, 'Etc/GMT-2' => 2.00, 'Etc/GMT-3' => 3.00,
'Asia/Tehran' => 3.30, 'Etc/GMT-4' => 4.00, 'Etc/GMT-5' =>
5.00, 'Asia/Kolkata' => 5.30, 'Asia/Katmandu' => 5.45,
'Etc/GMT-6' => 6.00, 'Asia/Rangoon' => 6.30, 'Etc/GMT-7' =>
7.00, 'Etc/GMT-8' => 8.00, 'Etc/GMT-9' => 9.00,
'Australia/Darwin' => 9.30, 'Etc/GMT-10' => 10.00, 'Etc/GMT-11'
=> 11.00, 'Etc/GMT-12' => 12.00, 'Etc/GMT-13' => 13.00);
?>
----
Server IP: 212.124.37.9
Probable Submitter: 93.132.159.158
----
Manual Page -- http://www.php.net/manual/en/function.date-default-timezone-set.php
Edit -- https://master.php.net/note/edit/108793
Del: integrated -- https://master.php.net/note/delete/108793/integrated
Del: useless -- https://master.php.net/note/delete/108793/useless
Del: bad code -- https://master.php.net/note/delete/108793/bad+code
Del: spam -- https://master.php.net/note/delete/108793/spam
Del: non-english -- https://master.php.net/note/delete/108793/non-english
Del: in docs -- https://master.php.net/note/delete/108793/in+docs
Del: other reasons-- https://master.php.net/note/delete/108793
Reject -- https://master.php.net/note/reject/108793
Search -- https://master.php.net/manage/user-notes.php