pdamoc

pdamoc

I need to translate a time that I have in a known timezone to a time in a location for which I know the city and zipcode.

Is there a library that already does this?
If not is there a free online service/API that could be used to solve this?
If not, how do you suggest to approach this task?

The cities are all in USA but I don’t live in USA. Maybe there is some official database that I can use.

Showing Posts 1 to 8

andrewb

andrewb

Hi,

I ended up using the Google Maps API and having a field for user to search for their City. I then extracted the timezone and other location data I needed.

I could not find a reliable alternative.

If this is an option let me know and I can post some code (However it is just javascript on the client as per the docs).

Andrew

PS: not free but low cost

hauleth

hauleth

You can use GeoNames to fetch position from the zip code, however I wouldn’t rely on that too much, because people can use different TZ than their “local” one (for example they are dealing with customers in different TZ, and it is easier for them to use TZ of the client). So I would rather ask - what for you need that?

tme_317

tme_317

I have found this data (which I use in my project) to be accurate and relatively low cost: ZIP code database with time zone, daylight saving time, area code, county, county FIPS code, ZIP code type, city and state for every 5-digit ZIP code

Google maps API could work but check the cost/TOS restrictions.

pdamoc

pdamoc OP

It is exactly one of these solutions that we’re implementing. Our app should display the time in the TZ of the client.

Thank you all for the suggestions. I will propose these solutions to my contact.

kip

kip

ex_cldr Core Team

The tz_world packages translates a geo point (a location with a lat, lng) into a timezone using map data from osm and timezone data from iana. So if you can translate a place into a location (with geonames for example), then tz_world will give you the timezone name. Its very cool.

Note that tz_data on hex requires ecto and postgres with postgis, but the master branch on GitHub does not and the author has indicated he will publish that version to hex this week.

pdamoc

pdamoc OP

This is very useful information. I already have tz_world installed as a dependency of timex.

mindok

mindok

timeanddate.com has an API: https://www.timeanddate.com/services/api/time-api.html (not free). Their main timezone page allows you to lookup by name or just zipcode so I would assume their API would too.

No affiliation - just used their meeting planner a lot in a previous life.

tme_317

tme_317

I don’t know how up-to-date this is but I found this free data including zips, timezones, and lat/long: https://public.opendatasoft.com/explore/dataset/us-zip-code-latitude-and-longitude/table/ Note the city name here is the “primary city name” of the given zip which is probably not good enough as multiple cities/town names can exist in a given zip.

Zips do change over time so the inexpensive (non-free) resource I sent over the other day updates changes from the authoritative USPS monthly if needed and does include all the “alternate” city names per zip.

Finally, for the purpose of city/town/hamlet name to lat/long (if using tz_world solution to get timezone) nothing beats the free USGS GNIS data: https://www.usgs.gov/core-science-systems/ngp/board-on-geographic-names/download-gnis-data

— All posts loaded —

Where Next? Top

Trending in Questions Top

stjefim
Hello! Suppose you are building workflow (order / task / payment) processing system with the following requirements: Each workflow con...
New
jonnycharles
I’m in search of an Elixir library that offers PDF generation capabilities similar to Ruby’s Prawn. While there have been discussions abo...
New
spammy
I’m looking to build a personal workflow to quickly deploy web applications written in elixir/phoenix, for local consumption (ie not on t...
New
dli
Before I dive in myself, did anyone successfully sprinkle Hologram into their existing LiveView app? Looking for hints regarding: Addi...
New
roeland
Kia ora, We have been using elixir-google-api to connect to Google Drive. However, with the updates to Tesla due to CVEs this is now bro...
New
bottlenecked
Hi all, I wanted to ask how the community is dealing with post-release steps. Today we have Ecto migrations, which make sure that the db...
New
rahultumpala
Hello, I have an Elixir backend that implements a custom protocol over TCP. I want to load test the backend and assess the performance o...
New

Other Trending Topics Top

JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
mcass19
ExRatatui lets you cook up rich terminal UIs in Elixir, powered by Rust’s ratatui via Rustler NIFs. Build interactive terminal applicatio...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
ausimian
Emily is an Elixir library that runs Nx computations on Apple’s MLX. Install it as the default Nx backend and Nx, defn, Axon, Nx.Serving,...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews