I am trying to get the current date with the addition of the time zone of the device, but will show 1 hour later than this starting date. I have a problem with DaylightSavingTime. How to disable isDaylightSavingTime = FALSE.
here is the code i used ..
NSDate *date = [NSDate Date]; NSTimeZone *currentTimeZon = [NSTimeZone localTimeZone]; if ([currentTimeZon isDaylightSavingTime]) { NSLog(@"East coast is NOT on DT"); } else { NSLog(@"East coast is on DT"); } NSTimeInterval timeZoneOffset = [currentTimeZon secondsFromGMTForDate:currentDate]; NSTimeInterval gmtTimeInterval = [date timeIntervalSinceReferenceDate] - timeZoneOffset; NSDate *gmtDate = [NSDate dateWithTimeIntervalSinceReferenceDate:gmtTimeInterval]; NSLog(@"### Announcement gmtDate = %@",gmtDate);
I get a time difference of 1 hour, the date is performative.
Sujal source share