Time by Location - abstractive/timez GitHub Wiki

#Time by Location

Get JSON response as a JSON Dictionary

Request

time = Timez::Location.get_time('LATITUDE', 'LONGITUDE', 'YOUR_API_KEY')

Response

{"status"=>"OK", "message"=>"", "countryCode"=>"BJ", "zoneName"=>"Africa/Porto-Novo", "abbreviation"=>"WAT", "gmtOffset"=>"3600", "dst"=>"0", "timestamp"=>1434391632}

Get UTC time

Request

time = Timez::Location.get_time_utc('LATITUDE', 'LONGITUDE', 'YOUR_API_KEY')

Response

2015-06-15 18:09:16 UTC

Get time from timestamp

Request

time = Timez::Location.get_time_zone('LATITUDE', 'LONGITUDE', 'YOUR_API_KEY')

Response

2015-06-15 23:40:22 +0530

Get timestamp

Request

time = Timez::Location.get_time_zone('LATITUDE', 'LONGITUDE', 'YOUR_API_KEY')

Response

1434391952