CLDev
CLDev

Reputation: 1074

Which timezone takes account into daylight savings?

Is there a timezone that I can use that takes in account of daylight savings? I know 'EDT' is for daylight savings, and 'EST' is not. Is there a timezone I can use that will automatically detect whether the datetime is daylight savings time? Will 'ET', or 'America/New_York' work?

EDIT::

Sorry should be more clear. I want to take a date and converted it to Eastern time zone but I want it to take into account whether the date in Eastern time zone is daylight savings or not.

Upvotes: 1

Views: 275

Answers (3)

AlexWien
AlexWien

Reputation: 28727

Most countries use time zones that use daylight savings!

Setup the correct TimeZone, in the Country/City format.
Once you have set the correct TimeZone then:
use NSTimeZone:isDaylightSavingTimeForDate:

Returns a Boolean value that indicates whether the receiver uses daylight savings time at a given date.

- (BOOL)isDaylightSavingTimeForDate:(NSDate *)aDate

Upvotes: 0

Darren
Darren

Reputation: 10129

An NSDate object represents a point in time independent of any time zone or daylight savings time. An NSTimeZone object will be able to take an NSDate object and determine the time in its time zone, accounting for daylight savings time if that time zone uses it.

'America/New_York' is a time zone that does use daylight savings time, so if you displayed your NSDate using an NSDateFormatter set to the 'America/New_York' time zone, it would account for daylight savings time.

Upvotes: 3

Hetal Vora
Hetal Vora

Reputation: 3361

I have used 'America/New_York' in the past and that should work.

Upvotes: 0

Related Questions