note 95361 deleted from function.date-default-timezone-set by thiago
| From: | thiago@php.net | Date: | Tue, 29 Dec 2009 13:09:28 +0000 |
| Subject: | note 95361 deleted from function.date-default-timezone-set by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-164424@lists.php.net to get a copy of this message | ||
Note Submitter: iateadonut at gmail dot com
----
that dude's code above needs to have a $offset = $offset*60*60; in it, like so:
<?php
function set_tz_by_offset($offset) {
$offset = $offset*60*60;
$abbrarray = timezone_abbreviations_list();
foreach ($abbrarray as $abbr) {
//echo $abbr."<br>";
foreach ($abbr as $city) {
//echo $city['offset']." $offset<br>";
if ($city['offset'] == $offset) { // remember to multiply $offset
by -1 if you're getting it from js
date_default_timezone_set($city['timezone_id']);
return true;
}
}
}
date_default_timezone_set("ust");
return false;
}
set_tz_by_offset(-1);
?>