Timezone Lookup API - Ruby Gem
Timezone Lookup is a simple tool for looking up timezone data. It returns the timezone name, offset, and more.
Installation
Add this line to your application's Gemfile:
gem 'apiverve_timezonelookup'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install apiverve_timezonelookup
Getting Started
Get your API key at APIVerve
Basic Usage
require 'apiverve_timezonelookup'
# Initialize the client
client = APIVerve::Timezonelookup::Client.new(api_key: "YOUR_API_KEY")
# Make a request
response = client.execute({ city: "Harare" })
# Print the response
puts response
Error Handling
begin
response = client.execute({ city: "Harare" })
puts response["data"]
rescue APIVerve::Timezonelookup::ValidationError => e
puts "Validation error: #{e.errors.join(', ')}"
rescue APIVerve::Timezonelookup::APIError => e
puts "API error: #{e.}"
puts "Status code: #{e.status_code}"
end
Debug Mode
# Enable debug logging
client = APIVerve::Timezonelookup::Client.new(
api_key: "YOUR_API_KEY",
debug: true
)
Example Response
{
"status": "ok",
"error": null,
"data": {
"timezone": "Africa/Harare",
"timezone_offset": 120,
"date": "2025-12-17",
"time": "00:30",
"time24": "00:30:23",
"time12": "12:30:23 AM",
"day": "Wednesday",
"month": "December",
"year": "2025",
"unix": "1765924223",
"dst": false,
"dst_start": "2025-12-17 00:30:23",
"dst_end": "2025-12-17 00:30:23",
"dst_name": "CAT"
}
}
Documentation
For more information, visit the API Documentation.
Support
- Website: https://timezonelookup.apiverve.com?utm_source=ruby&utm_medium=readme
- Email: hello@apiverve.com
License
This gem is available under the MIT License.