Converting from individual cities/states/country names to Windows time zone names
Hi all, I'm creating a software calculator project, and I'd like my users to be able to convert between time zones using what they're familiar with: country, or city/ state names. So I need to convert from these places to the corresponding Windows time zone, and have been looking for a database online to do so, without success. What I have been able to find is a way to convert from TZID (Olsen) to Windows timezone IDs using this URL: http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html So maybe there's a database which maps all the places of the world to TZID, and then I would use a two-step process instead of one. Any help would be much appreciated. When I say 'database', even just a HTML page would do, and then I can extract the right info.
On 2011/12/05 07:21 AM, Daniel White wrote:
I'm creating a software calculator project, and I'd like my users to be able to convert between time zones using what they're familiar with: country, or city/ state names.
So I need to convert from these places to the corresponding Windows time zone, and have been looking for a database online to do so, without success.
What I have been able to find is a way to convert from TZID (Olsen) to Windows timezone IDs using this URL: http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
So maybe there's a database which maps all the places of the world to TZID, and then I would use a two-step process instead of one.
Any help would be much appreciated. When I say 'database', even just a HTML page would do, and then I can extract the right info.
There's a shapefile by Eric Muller which tries to capture the boundaries of all the tzdata timezones in the world as (spherical) polygons: http://efele.net/maps/tz/world/ It should be fairly accurate for population centres but maybe not so much for outback regions close to the boundaries. -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
On Mon, 05 Dec 2011, Daniel White wrote:
So maybe there's a database which maps all the places of the world to TZID, and then I would use a two-step process instead of one.
Perhaps the "zone.tab" file distributed as part of tzdata would be useful. You could search for the country code in the first column, or search for nearby latitude/longitude in the second column, or both, and then display a menu of a few likely choices. --apb (Alan Barrett)
On Mon, 5 Dec 2011, Daniel White wrote:
So maybe there's a database which maps all the places of the world to TZID, and then I would use a two-step process instead of one.
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data). cheers, Derick
Hi all, thanks for your help, If it's okay, I'll answer to all of you in this one email.
I looked inside the download, and there seemed like nothing like a concise one to one mapping unfortunately.
Perhaps the "zone.tab" file distributed as part of tzdata would be useful. You could search for the country code in the first column, or search for nearby latitude/longitude in the second column, or both, and then display a menu of a few likely choices.
I don't think this is suitable, since many such as Canada have 6 time zones (okay I can live with that), but many famous states and cities aren't represented at all from what I can tell.
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data).
Certainly. I only want the most famous places, something closer to around 100k-200k filesize at the most (as my calc is only around 300k itself). If it means I have to filter yet another stage, then so be it, but then I would need to hunt for a list of the '1000 most well known places' (or similar) in the world. So it looks like back to the drawing board. I appreciate the help, but I find it rather surprising that something like this doesn't already exist. Just to say something like "London 3pm in New York" sounds like a very common thing to want. You'd think a lot of people would find such a database very useful. Am I mistaken here?
On 2011/12/05 05:18 PM, Daniel White wrote:
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data).
Certainly. I only want the most famous places, something closer to around 100k-200k filesize at the most (as my calc is only around 300k itself). If it means I have to filter yet another stage, then so be it, but then I would need to hunt for a list of the '1000 most well known places' (or similar) in the world.
The 'cities15000.zip' is closer to what you want, but it's still more data than you wanted (1.2 megs compressed, 3.3 megs uncompressed). -- -=( Ian Abbott @ MEV Ltd. E-mail: <abbotti@mev.co.uk> )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=-
Ian Abbott <abbotti <at> mev.co.uk> writes:
On 2011/12/05 05:18 PM, Daniel White wrote:
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data).
Certainly. I only want the most famous places, something closer to around 100k-200k filesize at the most (as my calc is only around 300k itself). If it means I have to filter yet another stage, then so be it, but then I would need to hunt for a list of the '1000 most well known places' (or similar) in the world.
The 'cities15000.zip' is closer to what you want, but it's still more data than you wanted (1.2 megs compressed, 3.3 megs uncompressed).
Actually that may do the trick - thank you. The second last entry in each line is the TZID too. If I take out all the other translated names and other gunk, I think I may be able to squash it to 1/10th the size. For anyone else who's interested, here is the key to the data too: http://download.geonames.org/export/dump/readme.txt If anyone knows of anything more suitable, let me know.
On Mon, 5 Dec 2011, Daniel White wrote:
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data).
Certainly. I only want the most famous places, something closer to around 100k-200k filesize at the most (as my calc is only around 300k itself). If it means I have to filter yet another stage, then so be it, but then I would need to hunt for a list of the '1000 most well known places' (or similar) in the world.
Population information is also in that database btw. There is a file "cities15000.txt" which lists as: cities15000.zip : all cities with a population > 15000 (ca 20.000), see 'geoname' table for columns cheers, Derick
Derick Rethans <tz <at> derickrethans.nl> writes:
Population information is also in that database btw. There is a file "cities15000.txt" which lists as: cities15000.zip : all cities with a population > 15000 (ca 20.000), see 'geoname' table for columns
cheers, Derick
Yes Ian mentioned the cities15000 file too. Since population info is in there too, I can filter to make it more like "cities50000" if you get what I mean :)
Derick Rethans <tz <at> derickrethans.nl> writes:
Population information is also in that database btw. There is a file "cities15000.txt" which lists as: cities15000.zip : all cities with a population > 15000 (ca 20.000), see 'geoname' table for columns
I've just realized - one thing sadly lacking from this database is the country each city is based in. That means clashes like 'Bedford' would have 2+ corresponding countries, but I can't easily list the specific country on top. Also if people want to search for a time zone by country name, I can't use that (and yes, for countries with multiple time zones, I'd at least average them out, which is better than nothing). Is there yet another database I can use to map these city names to their corresponding countries?
Daniel White <twinbee42 <at> skytopia.com> writes:
Is there yet another database I can use to map these city names to their corresponding countries?
Ignore my above post. I've just realized the ISO_3166-1 country code does exactly what I want: http://en.wikipedia.org/wiki/ISO_3166-1 Many thanks to all. That kind of data is a dream!
On 05/12/11 18:35, Daniel White wrote:
Also if people want to search for a time zone by country name, I can't use that (and yes, for countries with multiple time zones, I'd at least average them out, which is better than nothing).
It seems to me that what you need is a list of towns and cities with whatever search terms you want to extract their latitude and longitude. That can then be looked up on a map (someone provided a reference earlier). It's no longer a simple lookup, but it's future-proofing and more likely to give the right and expected answer. jch
Time Zone Master, available for free from www.relativedata.com, is a windows programme that uses geonames cities15000.txt then the olson tz database to represent times and locations in the past and future. It also does some interesting astronomical time calculations as well (sundial time, moon phases, sunrise/sunset, and seasons) On 2011-12-05 13:06, Derick Rethans wrote:
On Mon, 5 Dec 2011, Daniel White wrote:
There is one at http://download.geonames.org/export/dump/ (by country, it's a lot of data). Certainly. I only want the most famous places, something closer to around 100k-200k filesize at the most (as my calc is only around 300k itself). If it means I have to filter yet another stage, then so be it, but then I would need to hunt for a list of the '1000 most well known places' (or similar) in the world. Population information is also in that database btw. There is a file "cities15000.txt" which lists as: cities15000.zip : all cities with a population> 15000 (ca 20.000), see 'geoname' table for columns
cheers, Derick
--
What I have been able to find is a way to convert from TZID (Olsen) to Windows timezone IDs using this URL: http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html
I'm planning to update the data to support multiple TZID mapping (One Windows TZ -> Multiple TZIDs) in CLDR. I was considering this before, but it's quite a tough task (also keeping data up-to-date is not trivial). It looks you're trying to create mapping data from location to Windows time zone. You would find how difficult to achieve this soon. There are several type of issues. 1) No matching UTC offset in Windows For example, Australia/Eucla uses UTC+08:45 as base offset, but there is no such zones in Windows time zone list. There are several other instances. 2) No matching daylight saving time rule in Windows For example, Pacific/Easter observes daylight saving time from August, 2011 to March 2012. However, Windows does not have any UTC-06:00 zones supporting the daylight saving time rules (Windows UTC-06:00 zones are all Northern Hemisphere type rules). 3) Ambiguous mapping For example, Windows has following time zones with UTC+09:00 / no DST. (UTC+09:00) Osaka, Sapporo, Tokyo (UTC+09:00) Irkutsk (UTC+09:00) Seoul You have to decide one from above for some other territories using UTC+09:00/no DST. For example, Asia/Dili, Asia/Jayapura, Pacific/Palau. 4) Out of date data You may want to map Belarus to (UTC+02:00) Minsk. However, Minsk (Belarus) is currently using UTC+03:00/no DST. Microsoft suggests Windows users in Belarus to use (UTC+03:00) Kakiningrad for now [http://support.microsoft.com/kb/2625508]. -Yoshito
<yoshito_umaoka <at> us.ibm.com> writes: > > > What I have been able to find is a way to convert > from TZID (Olsen) > > to Windows > > timezone IDs using this URL: > > http://unicode.org/repos/cldr-tmp/trunk/diff/supplemental/zone_tzid.html > I'm planning to update the data to support multiple > TZID mapping (One Windows TZ -> Multiple TZIDs) in CLDR. I was considering > this before, but it's quite a tough task (also keeping data up-to-date > is not trivial). > It looks you're trying to create mapping data from > location to Windows time zone. You would find how difficult to achieve > this soon. > There are several type of issues. > 1) No matching UTC offset in Windows > For example, Australia/Eucla uses UTC+08:45 as base > offset, but there is no such zones in Windows time zone list. There are > several other instances. > 2) No matching daylight saving time rule in Windows > For example, Pacific/Easter observes daylight saving > time from August, 2011 to March 2012. However, Windows does not have any > UTC-06:00 zones supporting the daylight saving time rules (Windows UTC-06:00 > zones are all Northern Hemisphere type rules). > 3) Ambiguous mapping > For example, Windows has following time zones with > UTC+09:00 / no DST. > (UTC+09:00) Osaka, Sapporo, Tokyo > (UTC+09:00) Irkutsk > (UTC+09:00) Seoul > You have to decide one from above for some other territories > using UTC+09:00/no DST. For example, Asia/Dili, Asia/Jayapura, Pacific/Palau. > 4) Out of date data > You may want to map Belarus to (UTC+02:00) Minsk. > However, Minsk (Belarus) is currently using UTC+03:00/no DST. > Microsoft suggests Windows users in Belarus to use > (UTC+03:00) Kakiningrad for now [http://support.microsoft.com/kb/2625508]. > -Yoshito Hi, Thanks for the info. What you said makes me wonder even more Why Microsoft didn't go with TZID, and instead create their own half-baked substitute. A fine example of why standards are so important, and how the TZID system is of such great benefit to the world. In the end, I understand the flaws of Windows' time zone system, but I think I'll have to make do, as an alternative (for C#) would be many times the size of my own program. And I'm too keen on the user accessing the internet each time. Cheers, Dan
participants (7)
-
Alan Barrett -
Daniel White -
David Patte -
Derick Rethans -
Ian Abbott -
John Haxby -
yoshito_umaoka@us.ibm.com