Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Obtaining Time zone in android

Is there a way to obtain the time zone from the callbacks received

void onLocationChanged(Location location)  

using the time information that can be obtained from the location parameter

long Time = location.getTime();

Or if there is another way please provide info!

like image 794
rantravee Avatar asked Jul 15 '10 10:07

rantravee


1 Answers

You can use web service provided by the geonames.org. Supply latitude and longitude to get the time zone information.

http://ws.geonames.org/timezoneJSON?lat=47.01&lng=10.2:

{"time":"2010-07-24 18:35","countryName":"Austria","sunset":"2010-07-24 21:02","rawOffset":1,"dstOffset":2,"countryCode":"AT","gmtOffset":1,"lng":10.2,"sunrise":"2010-07-24 05:48","timezoneId":"Europe/Vienna","lat":47.01}
like image 50
CrazyCoder Avatar answered Sep 29 '22 22:09

CrazyCoder