4

I am able to get list of timezones using

NSArray *timezoneNames = [NSTimeZone knownTimeZoneNames] ;

but the generated list of timezones does not cover all the major city names. Like for India it shows only Kolkata city. While I expected to display the timezone for New Delhi (capital) also.

So I want to generate the same timezones list as iOS generates in its Settings->General->Date Time-> Timezone because it shows almost all the major cities of the world. Can we fetch this list? Or do we need to create our own database(say .plist) for this?

Carl Veazey
  • 18,392
  • 8
  • 66
  • 81
Saurabh Shukla
  • 1,368
  • 3
  • 14
  • 26

3 Answers3

4

Settings.app uses a plist file to display the timezone list. The name of file is: "all_cities_adj.plist". To get to this file you need to traverse deep down into the SDK itself. I have mentioned the traverse path below where you can find it.

1.Go to the folder where you have your Xcode. 2.Right-Click on it and then click Show Package Contents. 3.Then Contents --> Developer --> Platforms --> iPhoneSimulator.platform --> Developer --> SDKs --> iPhoneSimulator6.1.sdk --> System --> Library --> PrivateFrameworks --> AppSupport.framework 4.In this folder you can find the plist file.

Please let me know if it helped...

Amboj
  • 148
  • 1
  • 7
  • Thanks @Amboj for the answer +1 and I am accepting this. Can you please share the traverse path for the real time device not simulator? Else we will be require to use this .plist to simulate the same. – Saurabh Shukla Jan 13 '14 at 10:29
  • @Saurabh :As per my knowledge, i think this plist can not be taken from device. So i suppose the only way we have is to use the same .plist and simulate it. Hope it helped you. Thanks for acceptance. – Amboj Jan 14 '14 at 07:36
  • this does not currently exists in ios 8, do you happen to know what did they change?( if maybe they implemented the dictionary) – Radu Vlad Jan 23 '15 at 12:28
0

I've been running into this problem as well and there is no way to get the same timezones as in the settings app.

You will need to create you own list.

rckoenes
  • 69,092
  • 8
  • 134
  • 166
  • Thanks. If we create our own list to add some more cities then how can we identify a specific time zone for a city due to different daylight saving rules around the world? – Saurabh Shukla Jan 23 '13 at 14:50
0

Firstly you need to download the .csv file which will provide you country/cities/timezone/region. Using this file we can display the list of countries and their cities. When user select any city we need to map it with the respected country and then this country needs to be map with device's timezones([NSTimeZone knownTimeZoneNames];).

This link also might be useful in this regard:

Get timezone by Country and Region

Community
  • 1
  • 1
Saurabh Shukla
  • 1,368
  • 3
  • 14
  • 26