isDaylightSavingTime
Returns a Boolean value that indicates whether the receiver is currently using daylight saving time.
- (BOOL)isDaylightSavingTime
Return Value
YES
if the receiver is currently using daylight savings time, otherwise NO
.Discussion
This method invokes
isDaylightSavingTimeForDate:
with the current date as the argument.
Example of [NSTimeZone isDaylightSavingTime]
NSTimeZone *easternTimeZone = [NSTimeZone timeZoneWithName:@"US/Eastern"];
if ([easternTimeZone isDaylightSavingTime]) {
NSLog(@"East coast is NOT on DT");
} else {
NSLog(@"East coast is on DT");
}
Example of [NSTimeZone isDaylightSavingTime]
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];
[dateFormatter setDateFormat:@"M/d h:mm a"];
if([[NSTimeZone systemTimeZone] isDaylightSavingTime]) {
NSLog(@"DLS");
}
[NSTimeZone resetSystemTimeZone];
[dateFormatter setTimeZone:[NSTimeZone systemTimeZone]];