I have to upload an image and with that i have to send the date and time when the image is uploaded, I am getting the latitude and longitude of the device from which it is uploaded, now i want to get the time and date of that location at that point of time when the image is uploaded. I do not want to take the date and time from device, Is it possible to get the date and time with the help of latitude and longitude of that place.
Asked
Active
Viewed 1,090 times
1 Answers
1
You can get the time zone and the current local time for a lat long from webservice by GeoNames http://www.geonames.org/export/web-services.html#timezone.
Demo link http://api.geonames.org/timezoneJSON?lat=47.01&lng=10.2&username=demo
Output Format
{"time":"2011-12-28 08:03",
"countryName":"Austria",
"sunset":"2011-12-28 16:36",
"rawOffset":1,
"dstOffset":2,
"countryCode":"AT",
"gmtOffset":1,
"lng":10.2,
"sunrise":"2011-12-28 08:04",
"timezoneId":"Europe/Vienna",
"lat":47.01
}
Register for a username here http://www.geonames.org/login

Rajdeep Dua
- 11,190
- 2
- 32
- 22
-
Can you provide me sample code or any example, then it will be more clear to me. – zaiff Dec 28 '11 at 07:04
-
added in the response. Add your lat long to the demo link and get the response – Rajdeep Dua Dec 28 '11 at 07:05
-
Can't i get it without using their webservice.Is there any other way possible? – zaiff Dec 28 '11 at 07:22
-
theoretically yes, you will have to convert lat long into a time zone using an algo. Try this open source library http://ll2tz.sourceforge.net/ – Rajdeep Dua Dec 28 '11 at 07:27
-
credits? will this be a problem? **{"status":{"message":"the daily limit of 30000 credits demo has been exceeded. Please throttle your requests or use the commercial service.","value":18}}** – TryTryAgain Dec 28 '11 at 08:44