Saurabh Shukla
Saurabh Shukla

Reputation: 1398

Get the similar timezone list as in iphone Settings app

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?

Upvotes: 4

Views: 1707

Answers (3)

Amboj
Amboj

Reputation: 148

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...

Upvotes: 4

Saurabh Shukla
Saurabh Shukla

Reputation: 1398

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

Upvotes: 0

rckoenes
rckoenes

Reputation: 69469

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.

Upvotes: 0

Related Questions