In javascript we can get timezone offset with
var current_date = new Date();
current_date.getTimezoneOffset();
Result => -330
I want to get that in iOS (Objective-C)
can someone help please ?
In javascript we can get timezone offset with
var current_date = new Date();
current_date.getTimezoneOffset();
Result => -330
I want to get that in iOS (Objective-C)
can someone help please ?
There is a very nice NSTimeZone object which will give you the timezone offset from GMT in seconds: Below code gives you timezone offset in HOURS
NSDate *sourceDate = [NSDate date];
NSTimeZone* destinationTimeZone = [NSTimeZone localTimeZone];
float timeZoneOffset = [destinationTimeZone secondsFromGMTForDate:sourceDate] / 3600.0;
NSLog(@"sourceDate=%@ timeZoneOffset=%f", sourceDate, timeZoneOffset);