How to get the current time in any location

前端 未结 1 1827
暗喜
暗喜 2021-01-16 03:22

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 u

相关标签:
1条回答
  • 2021-01-16 03:58

    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

    0 讨论(0)
提交回复
热议问题