2
votes

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.

3
What are you trying to do? Daylight savings is based on the current time zone. Not everyone is in daylight savings at the same time.Marcus Adams

3 Answers

3
votes

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.

0
votes

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

0
votes

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