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

有帮助吗?

解决方案

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

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top