}
$ce = DB_DataObject::factory('core_enum');
- $ce->query('
+ $ce->query("
SELECT
- *, TIME_FORMAT(TIMEDIFF(NOW(), CONVERT_TZ(NOW(), Name, "UTC")), "%H:%i") as timeOffset
+ *, TIME_FORMAT(TIMEDIFF(NOW(), CONVERT_TZ(NOW(), Name, 'UTC')), '%H:%i') as timeOffset
FROM
mysql.time_zone_name
+ WHERE
+ Name NOT LIKE '%/%'
+ AND
+ NAME NOT LIKE 'Etc%'
ORDER BY
timeoffset DESC,
Name DESC
- ');
+ ");
while($ce->fetch()) {
// ignroe timezone such as 'CET' and 'America/Argentina/Buenos_Aires'
continue;
}
- $displayOffset = '(GMT ' . ((substr($ce->timeOffset, 0, 1) == '-') ? '' : '+') . $ce->timeOffset . ')';
- $offsetAr = explode(':', $ce->timeOffset);
-
+ $displayArea = str_replace('_', ' ', $ar[1]);
+
+ $timeOffset = ((substr($ce->timeOffset, 0, 1) == '-') ? '' : '+') . $ce->timeOffset;
+ $displayOffset = '(GMT ' . $timeOffset . ')';
self::$timezones[$ce->Name] = array(
'region' => $ar[0],
'area' => $ar[1],
- 'displayName' => $ce->Name . ' ' . $displayOffset,
- 'displayArea' => $ar[1] . ' ' . $displayOffset,
- 'decimalOffset' => ($offsetAr[0] . ($offsetAr[1] / 60))
+ 'displayName' => $ar[0] . '/' . $displayArea . ' ' . $displayOffset,
+ 'displayArea' => $displayArea . ' ' . $displayOffset,
+ 'timeOffset' => $timeOffset
);
}