2

I've got Time Zone: Central European Summer Time in OS X (automatically based on location). When running my code on simulator I'm getting these results:

NSTimeZone *tz = [NSTimeZone localTimeZone]; // Gives me Local Time Zone (Europe/Warsaw (CEST) offset 7200 (Daylight))

NSString *tzString = [tz localizedName:NSTimeZoneNameStyleShortStandard
                                locale:[NSLocale currentLocale]]; // Gives me CET

Same with EDT / EST - when I set current time as EDT in System -> Preferences then appropriate methods return EST..

Am I missing something?

rafek
  • 5,464
  • 13
  • 58
  • 72

2 Answers2

4

The Standard in NSTimeZoneNameStyleShortStandard specifically means the non-DST name for the time zone.

If you want to use the DST name or not depending on DST status as of some date, you'd probably have to use -isDaylightSavingTimeForDate: to decide on NSTimeZoneNameStyleShortStandard versus NSTimeZoneNameStyleShortDaylightSaving.

Greg Parker
  • 7,972
  • 2
  • 24
  • 21
0

Apple warns of the use of the abbrevations for timezones. Better use the known offset to compute with +timeZoneForSecondsFromGMT:

Use the property -daylightSavingTimeto check day light saving status.

Karsten
  • 1,869
  • 22
  • 38