Friday, May 3, 2013

NSTimeZone isDaylightSavingTimeForDate example ios


isDaylightSavingTimeForDate:

Returns a Boolean value that indicates whether the receiver uses daylight savings time at a given date.
- (BOOL)isDaylightSavingTimeForDate:(NSDate *)aDate
Parameters of [NSTimeZone isDaylightSavingTimeForDate]
aDate
The date against which to test the receiver.
Return Value
YES if the receiver uses daylight savings time at aDate, otherwise NO.
Example of [NSTimeZone isDaylightSavingTimeForDate]
NSTimeZone *systimeZone = [NSTimeZone systemTimeZone];
    NSString *timeZoneString = [systimeZone localizedName:NSTimeZoneNameStyleShortStandard locale:[NSLocale currentLocale]];
    if([systimeZone isDaylightSavingTimeForDate:[NSDate date]]){
        timeZoneString = [systimeZone localizedName:NSTimeZoneNameStyleShortDaylightSaving locale:[NSLocale currentLocale]];
    }
 NSLog(@"%@",timeZoneString);