2010-10-06 19 views
3

我想要一個UI組件的所有最常見時區的列表。通過在Zend框架挖我發現supplementalData.xml(使用的Zend_Locale成分)具有metazones的列表,首選TZ數據庫時區名稱如何從Zend Framework的Zend_Locale獲取metazones列表?

<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"/> 
     (...) 

我認爲這可能是一個很好的適合我的需要我想提取這個列表。 而不是黑客我的版本的庫我想知道是否有一種方法可以通過常規手段獲取此列表(似乎沒有辦法,並且這個metazones信息似乎沒有被查詢任何地方)。

謝謝!

回答

1

我不知道你是哪個後,但你的最佳人選是

$locale->getTranslationList('TerritoryToTimezone'); 

其中TerritoryToTimezone可以與任何的參考手冊Zend_Locale subchapter Obtaining Localized Data描述標識符的交換。

如果這些都沒有給你你正在尋找的東西,你仍然可以use DOM to parse the XML

+0

可能是我最好的選擇呢。我將擴展'Zend_Locale_Data'類來提供我需要的支持。 – 2010-10-09 06:48:44

0

您可以使用timezone_abbreviations_list(),timezone_identifiers_list()... 最後一組功能here

相關問題