blob: 3bf3708c6a9aac641af00e78819365828598a8a3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
<?php
/**
* This file generates a map from windows timezones to tz database timezones
*
* @author Clement Wong <cw@clement.hk>
* @license http://www.opensource.org/licenses/mit-license.php MIT License
*/
$windows_timezones = [];
$windowstimezonexml = new DOMDocument();
$windowstimezonexml->load('https://raw.githubusercontent.com/unicode-org/cldr/master/common/supplemental/windowsZones.xml');
$zones = $windowstimezonexml->getElementsByTagName('mapZone');
foreach ($zones as $zone) {
if ($zone->getAttribute('territory') === '001') {
$windows_timezones[$zone->getAttribute('other')] = $zone->getAttribute('type');
}
}
file_put_contents(__DIR__ . '/../src/WindowsTimezones.php', "<?php\n\$windows_timezones = " . var_export($windows_timezones, true) . ';');
|