Search code examples
iostimezonedstdate-conversion

Daylight to Standard timezone conversion in iOS


Some countries are observing daylight saving, but I want to get the timezone name irrespective of daylight saving.

In short I want standard time of such countries instead of daylight saving time.

Is there any way to convert this or anything else?

P.S. I want this because of my server requirement.

//----------------------------------------------------------------

I have seen this reference in apple.

+ (instancetype)timeZoneForSecondsFromGMT:(NSInteger)seconds

Discussion The name of the new time zone is GMT +/– the offset, in hours and minutes. Time zones created with this method never have daylight savings, and the offset is constant no matter the date.

But I wonder how it will useful to me for my problem? As I want timezone name without daylight saving not any time with offset.


Solution

  • It was actually this

    typedef enum : NSInteger {
       NSTimeZoneNameStyleStandard,
       NSTimeZoneNameStyleShortStandard,
       NSTimeZoneNameStyleDaylightSaving,
       NSTimeZoneNameStyleShortDaylightSaving,
       NSTimeZoneNameStyleGeneric,
       NSTimeZoneNameStyleShortGeneric 
    } NSTimeZoneNameStyle;
    

    The enum answered it for me. My bad , I should have read this earlier.