Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you get the local timezone based on core location coordinates?

Is it possible in cocoa touch to get the local timezone of device based on the coordinates from the gps? I saw this asked last year, but no answer...

All I really want is the number of hours difference from GMT, and I don't want to query a web service.

Or, can I ask the device what timezone it is set to?

Can it be done?

like image 267
Steve Avatar asked Dec 06 '10 22:12

Steve


1 Answers

Use [NSTimeZone localTimeZone];

Edit: The returned object has a -(NSInteger)secondsFromGMT method you can use to figure out the difference from GMT.

like image 74
James J Avatar answered Oct 10 '22 00:10

James J