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

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
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
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
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
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews