stefanluptak

stefanluptak

Get timezone from country code / city

Hi all,

I am doing a Stripe integration and I would like to send a scheduled email to the customer. It should be scheduled to a given time of the day, but in his timezone.

I have a country code (ISO 3166-1 alpha-2) and a city of the customer. Those can be the inputs of a function. His approximate timezone should be the output.

Any ideas where to look? Thanks a lot.

Marked As Solved

mathieuprog

mathieuprog

Check TzExtra and its TzExtra.countries_time_zones/1 function (it depends on Tz).

And GitHub - kimlai/tz_world: Resolve timezones from a location. ?

Also Liked

Marcus

Marcus

Maybe you can generate a mapping from the GeoNames data http://download.geonames.org/export/dump/readme.txt

kartheek

kartheek

I know about these:

Any specific country/continent you are looking for ?

stefanluptak

stefanluptak

Thanks a lot. I will take a look at those. Well, I am looking for all continents. :slight_smile:
I am aware, that there are countries with multiple timezones, in that case some average of those would be enough.

Maybe even something simple like this would be enough:

# SVK is Europe/Bratislava (in Slovakia)
# +1 is UTC offset in our country.
my_function("SVK") # +1
kartheek

kartheek

Nice, no need to deal directly with external databases and mappings.

Where Next?

Popular in Questions Top

dotdotdotPaul
Okay, I'm having a heck of a time trying to figure out how to best handle the validation of belongs_to associations in Ecto. I'm sure I'...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
myronmarston
The Elixir Typespec docs show the following syntax for keyword lists in typespecs: # ... | [key: type] # keyword lis...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
idi527
I’ve been re-reading swift book again and noticed that multiline strings there don’t have a trailing line break, unlike in elixir iex(2)...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
chrismccord
Phoenix 1.4.0 released Phoenix 1.4 is out! This release ships with exciting new features, most notably with HTTP2 support, improved deve...
688 30048 115
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
fireproofsocks
I’m working on defining a simple Ecto schema for a table (in PostGres), but I don’t see where I can define a column as NOT NULL. Conside...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
lk-geimfari
What is most correct way to open, read and parse JSON file with poison? For example if we have example.json file in root of some projec...
New
hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
aesmail
Hello guys, I have finally made it. I created an admin interface for a framework. It’s been on my todo list for years and with the curre...
New

We're in Beta

About us Mission Statement