質問

When I print this from my app:

NSLog(@"%@", [NSTimeZone localTimeZone]);

the log shows:

Local Time Zone (Europe/London (GMT+1) offset 3600 (Daylight)) 

or

Local Time Zone (US/Eastern (GMT-4) offset -14400 (Daylight))

Is there an interface that returns only the place? Eg Europe/London or US/Eastern respectively? I don't really want to parse the result string.

役に立ちましたか?

解決 2

Try: [[NSTimeZone localTimeZone] name]

他のヒント

Try

NSLog(@"Time zone : %@",[[NSTimeZone localTimeZone] name]);

Use this code .

[[NSTimeZone localTimeZone] localizedName:NSTimeZoneNameStyleGeneric locale:[NSLocale systemLocale]];
ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top