0

I'd like to get raw offset from GMT. I know the answer could be like that:

NSTimeZone *zone = [NSTimeZone timeZoneWithName:@"Europe/Berlin"];
NSInteger *offset = [zone secondsFromGMT];

(like here: iOS - How to get raw offset for timezone?)

But the problem is, it doesn't give me raw offset (for Berlin +1), but only offset with DST (+2), that is, for the current date.

Community
  • 1
  • 1
schmidt9
  • 4,436
  • 1
  • 26
  • 32

1 Answers1

5

NSTimeZone has a property daylightSavingTimeOffset which returns the difference to the raw offset

NSTimeZone *zone = [NSTimeZone timeZoneWithName:@"Europe/Berlin"];
NSTimeInterval rawOffset = [zone secondsFromGMT] - [zone daylightSavingTimeOffset];
vadian
  • 274,689
  • 30
  • 353
  • 361