Skip to content

Instantly share code, notes, and snippets.

@joshsmith
Created October 6, 2010 05:02
Show Gist options
  • Save joshsmith/612856 to your computer and use it in GitHub Desktop.
Save joshsmith/612856 to your computer and use it in GitHub Desktop.
<?php
static $regions = array(
'Africa' => DateTimeZone::AFRICA,
'America' => DateTimeZone::AMERICA,
'Antarctica' => DateTimeZone::ANTARCTICA,
'Aisa' => DateTimeZone::ASIA,
'Atlantic' => DateTimeZone::ATLANTIC,
'Europe' => DateTimeZone::EUROPE,
'Indian' => DateTimeZone::INDIAN,
'Pacific' => DateTimeZone::PACIFIC
);
foreach ($regions as $name => $mask) {
$tzlist[] = DateTimeZone::listIdentifiers($mask);
}
echo '<select>';
echo '<option>Pick your timezone</option>';
$count = 0;
foreach($tzlist as $timezones) {
foreach($timezones as $timezone) {
echo '<option value="' . ++$count . '">' . $timezone . '</option>';
}
}
echo '</select>';
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment