user3517855
user3517855

Reputation: 211

In iphone, how do I obtain the city of current timezone?

e.g.

I have this current value GMT+8 ..or GMT+9 how do I obtain the city name of this timezone?

like *GMT+8 should output "MANILA"

or *GMT+9 should output "TOKYO"

is that possible? THANKS!

*depending on the iPhone settings located on the settings app

Upvotes: 0

Views: 83

Answers (1)

Rashad
Rashad

Reputation: 11197

Try this:

NSTimeZone *cur = [NSTimeZone localTimeZone];
NSString *name = [cur name];
NSLog(@"%@",name);

The output will be like this:

Asia/Dhaka

For your case, construct a NSTimeZone object with your desired time zone then use this process to get the city name.

Hope this helps.. :)

Upvotes: 1

Related Questions