Created
May 19, 2022 13:56
-
-
Save stevebauman/122ed0899e4c988bec5c84178c23bd69 to your computer and use it in GitHub Desktop.
Human Friendly Timezone List Generator PHP
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$timezones = array_map(function ($timezone) { | |
$date = new DateTime('now', $tz = new DateTimeZone($timezone)); | |
return [ | |
'timezone' => $timezone, | |
// Format: "(GMT -05:00) America/Toronto" | |
'label' => "({$date->format('\G\M\T P')}) {$tz->getName()}", | |
]; | |
}, DateTimeZone::listIdentifiers()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generates associative array: