Created
October 6, 2010 04:55
-
-
Save joshsmith/612850 to your computer and use it in GitHub Desktop.
This file contains 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
<?php | |
foreach($tzlist as $items) { | |
foreach($items as $item) { | |
echo "INSERT INTO timezones (timezone) VALUES ('" . $item . "');"; | |
} | |
} |
This file contains 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
<?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>'; |
This file contains 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
CREATE TABLE timezones ( | |
tid INT(11) NOT NULL AUTO_INCREMENT PRIMARY KEY, | |
timezone VARCHAR(30) NOT NULL | |
) ENGINE=InnoDB; |
This file contains 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
CREATE TABLE users_timezones ( | |
uid INT(11) NOT NULL, | |
tid INT(11) NOT NULL, | |
FOREIGN KEY (uid) REFERENCES users(uid), | |
FOREIGN KEY (tid) REFERENCES timezones(tid) | |
) ENGINE=InnoDB; |
This file contains 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
<?php | |
$len = strlen('America/Argentina/Rio_Gallegos'); | |
echo $len; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment