views:

25

answers:

2

Hi,

I'm trying to have a list of all the most common time zones for a UI component. By digging in the Zend framework I found that supplementalData.xml (used by the Zend_Locale component) has a list of metazones, with prefered TZ database time zone names

    <mapTimezones type="metazones">
        <mapZone other="Acre" territory="001" type="America/Rio_Branco"/>
        <mapZone other="Afghanistan" territory="001" type="Asia/Kabul"/>
        <mapZone other="Africa_Central" territory="001" type="Africa/Maputo"/>
        <mapZone other="Africa_Central" territory="BI" type="Africa/Bujumbura"/>
        <mapZone other="Africa_Central" territory="BW" type="Africa/Gaborone"/>
        <mapZone other="Africa_Central" territory="CD" type="Africa/Lubumbashi"/>
        (...)

I think that could be a nice fit for my needs and I'd like to have this list extracted. Rather than hacking my version of library I'd like to know if there is a way to get this list by normal means (there doesn't seem to be a way and this metazones info does not seem to be queried anywhere).

Thanks!

A: 

I am not sure which one you are after, but your best candidate is

$locale->getTranslationList('TerritoryToTimezone');

where TerritoryToTimezone can be exchanged with any of identifiers described in the reference manual for Zend_Locale subchapter Obtaining Localized Data.

If none of these give you what you are looking for, you can still use DOM to parse the XML.

Gordon
Probably my best bet then. I will extend the `Zend_Locale_Data` class to provide support for what I need.
Guillaume Bodi
A: 

You can use timezone_abbreviations_list(), timezone_identifiers_list()... Last set of functions here

MatTheCat