note 107090 added to function.timezone-abbreviations-list
| From: | Anonymous at osu1 dot php dot net | Date: | Fri, 06 Jan 2012 03:50:27 +0000 |
| Subject: | note 107090 added to function.timezone-abbreviations-list | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-185385@lists.php.net to get a copy of this message | ||
Here is a way to do what dustianalan posted on 21-Apr-2010 but with PHP versions below 5.2 where you
don't have the new DateTime class. Same basic concept, format a date in the time zone
specified and only show the time zone abbreviation. I recommend you store the current default time
zone in a variable before executing this code and restoring it after.
<?php
$previousDefaultTimeZone = date_default_timezone_get();
date_default_timezone_set('America/Los_Angeles');
echo date('T');
date_default_timezone_set($previousDefaultTimeZone)
?>
Will echo PST or PDT.
----
Server IP: 69.147.83.197
Probable Submitter: 64.39.108.115
----
Manual Page -- http://www.php.net/manual/en/function.timezone-abbreviations-list.php
Edit -- https://master.php.net/note/edit/107090
Del: integrated -- https://master.php.net/note/delete/107090/integrated
Del: useless -- https://master.php.net/note/delete/107090/useless
Del: bad code -- https://master.php.net/note/delete/107090/bad+code
Del: spam -- https://master.php.net/note/delete/107090/spam
Del: non-english -- https://master.php.net/note/delete/107090/non-english
Del: in docs -- https://master.php.net/note/delete/107090/in+docs
Del: other reasons-- https://master.php.net/note/delete/107090
Reject -- https://master.php.net/note/reject/107090
Search -- https://master.php.net/manage/user-notes.php