加拿大和美国时区PHP



我想仅在加拿大和美国的时区显示下拉。搜索后,我尝试应用DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US')很酷,但它仅返回美国时区,而不是加拿大人也尝试使用DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'US'|'CA'),它仅返回 Pacific/apia DateTimeZone::listIdentifiers(DateTimeZone::AMERICA)返回所有美洲的时区。

上面的coment提供了解决方案
'items' => array_merge(DateTimeZone::listIdentifiers(DateTimeZone::PER_‌​COUNTRY, 'US'), DateTimeZone::listIdentifiers(DateTimeZone::PER_COUNTRY, 'CA'))

最新更新