1

I am currently working on an something that contains the ability for a user to do simple time conversions to various time zones based on City, so a user would select a city name and then select the time they wish to convert to the other time zone selected. I am currently using the time zones found in NSTimeZone's database, which I loop through and then create an NSTimeZone object using the method knownTimeZoneNames. My issue is that this database that NSTimeZone presents to me seems to be different to the one being used by Apple in their clock app. Multiple cities that I can access through Apple's built in app are simply not available to me in when looping through knownTimeZoneNames.

I have looked into the tz or zoneinfo database created by IANA but it seems this database is also lacking a number of the places I can see, again, in the Clock app. An example of this would be Geneva, Switzerland.

Does anyone have any idea where this database may have come from? Or is it potentially another database that contains other cities and timezone's that are then matched to the existing database in NSTimeZone?

Another thing I'm not sure of is where the country database comes from. In the NSTimeZone database you only get the region (Asia, Europe, America, etc.) and the city name, but for example many of the African cities it would be best practise to have the city name and country name - where does this come from?

Thanks.

tizaks
  • 172
  • 2
  • 9

2 Answers2

6

An easy way of obtaining city/timezone data is hack a widget called World Clock (for OS X), which is developed by Apple, Inc. Navigate to the big Library folder and then to Widgets. Right click on World Clock and open the file named WorldClock.js with a text editor. This file contains lines of city names and their corresponding timezone names. That's what I use for my clock application.

El Tomato
  • 6,479
  • 6
  • 46
  • 75
0

You should may be check : The google Timezone API. As it seems that it needs lat, lng, you should first use the google geocoding API in order to convert city name to coordinates.

Hugo
  • 856
  • 1
  • 10
  • 30