Vasyl Kozhushko
Vasyl Kozhushko

Reputation: 83

get timezone by country code jquery

I try to build weather service. Country name that I got from main server came in code format (Like US, UK, CA, etc.) Based on that server info I need to get local time zone by city name. I found Moment js Timezone, but there they using full name of country, so I need to convert country code to full country name or get time zone by city name in other way. Any ideas how to do that?

Upvotes: 3

Views: 2910

Answers (2)

MTroy
MTroy

Reputation: 897

To complete the database included with jquery.detect_timezone (thanks to Farhad) and your "moment timezone" solution

I've found that maxmind's database provides mapping file between regions and time zones from Olsen database (aka tz database): http://www.maxmind.com/timezone.txt

Easy to parse and trying to compare to the full name country !

EDIT:

(i just omit to precise the "time" of "zone" is missing, juste the names) :D

Upvotes: 0

Farhad Enayati
Farhad Enayati

Reputation: 161

this plugin maybe help you...

https://github.com/scottwater/jquery.detect_timezone

Upvotes: 1

Related Questions