note 107090 deleted from function.timezone-abbreviations-list by danbrown
| From: | danbrown@php.net | Date: | Fri, 06 Jan 2012 19:11:25 +0000 |
| Subject: | note 107090 deleted from function.timezone-abbreviations-list by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-185405@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
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.