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
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
Maybe you can generate a mapping from the GeoNames data http://download.geonames.org/export/dump/readme.txt
dmarko484
Maybe this? Timex.TimezoneInfo — timex v3.7.6
kartheek
I know about these:
- Paid - Google Timezone API
- Paid/Free - Maxmind GeoIP/GeoLite Cities
Any specific country/continent you are looking for ?
stefanluptak
Thanks a lot. I will take a look at those. Well, I am looking for all continents. 
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
Nice, no need to deal directly with external databases and mappings.







