cateof
cateof

Reputation: 6758

iOS get the place value from timeZone

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.

Upvotes: 0

Views: 146

Answers (3)

Mihai
Mihai

Reputation: 1

Use this code .

[[NSTimeZone localTimeZone] localizedName:NSTimeZoneNameStyleGeneric locale:[NSLocale systemLocale]];

Upvotes: 0

NKB
NKB

Reputation: 649

Try

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

Upvotes: 1

Gad
Gad

Reputation: 2877

Try: [[NSTimeZone localTimeZone] name]

Upvotes: 0

Related Questions