The easiest way to convert lat lng / zip / city / state to Timezone in Ruby

I am interested in getting a time zone for my users. I already have my city, state, zip code, lat and lng, and I would like to get their time zone. I have one service that does this conversion ( http://api.geonames.org/timezone?lat=47.01&lng=10.2&username=demo ), however I was wondering if there was a better solution or someone turned to bring this functionality to a decent gem.

+2
source share
2 answers

See this:

http://rubygems.org/gems/timezone

Should be the case:

gem install timezone 

And then read the documentation to connect the application to it.

Good luck

+4
source

There is a gem that uses google timezone service

https://github.com/sck-v/google_timezone

 result = GoogleTimezone.fetch(50.1196004, 8.679918299999999) result.time_zone_id # gives you 'Europe/Berlin' 
+1
source

Source: https://habr.com/ru/post/1335245/


All Articles