views:

184

answers:

1

How can I get the Timezone offset in Objective-C (for iPhone OS 3)?

Example GMT -5 is US Eastern Time... I want the -5.

+1  A: 
[timeZone secondsFromGMT] / 3600
Chuck
Which, believe it or not, comes from the incredibly useful `NSTimeZone` class.
Dave DeLong
What datatype does that return?
Moshe
It returns an `NSInteger`.
Chuck
Thank you Chuck.
Moshe
Actually - `[[NSTimeZone localTimeZone] secondsFromGMT] / 3600`
Moshe