2

As we can get timezone from country code like

c = TZInfo::Country.get('US')
zones = c.zone_identifiers

this returns all zones of country.

But I need specific zone of location i.e. "washington, USA"
Is there a way to get timezone from location name?

so we can get timezone by giving location name("washington, USA")

Raghvendra Parashar
  • 3,883
  • 1
  • 23
  • 36
  • You can find the answer here, http://stackoverflow.com/questions/8349817/ruby-gem-for-finding-timezone-of-location# – Srikanth Jeeva Apr 05 '13 at 06:28
  • 1
    Geokit::Geocoders::GoogleGeocoder.geocode require complete address but here rkp has only location . – Vik Apr 05 '13 at 06:37

1 Answers1

1

You could download the geonames db and compare lat/lng to the nearest place (with timezone) in the db

  • Download the database of cities from geonames.org
  • convert it to a compact lat/lon -> timezone list
Vik
  • 5,931
  • 3
  • 31
  • 38