Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I'm developing an newsletter sending application on C#/.NET platform. I've recently added the module to retrieve the country and region of a recipient by his IP address using maxmind.com database.

For example, I can get the following info for some sample IP address:

Country Code: DE
Country Name: Germany   
Region Name:  Hessen 
City:         Frankfurt Am Main
Latitude:     50.1167
Longitude:    8.6833 

What I need now is to get the user's time zone using this information.

I know there are some GeoIp databases that provide also the time zone, but I need to use this concrete GeoIp database. Also, javascript's approach to determine time offset can't be used here.

May be I can get somehow the timezone using country and region name?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
865 views
Welcome To Ask or Share your Answers For Others

1 Answer

Finally, after long research, I've found the solution. It may not be much accurate, but it does not require the dependency of remote service.

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

The second step was to convert Olsen timezones in .NET timezones. The best suitable solution was found here: https://www.timdavis.com/posts/olson-time-zone-database-to-standard-windows-time-zone-v0-1 So I've edited it a bit and converted it to CSV file to read it from .NET.

Hope it will help somebody.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...