views:

155

answers:

2

Hi folks,

is there anyway I could figure out an estimated (Olson) ZoneInfo value (eg. ("America/Los Angeles", "Europe/London", etc.), for a single public IP address ... in .NET?

I already have a full list of ZoneInfo values, so that's not a problem ... and in a drop down box. I just want to default a selected value based on an IP.

I understand the IP won't be 100% accurate and proxies could frak things ... but this is to get a rough value.

Is this possible?

I was thinking it might be possible to associate a ZoneInfo value to a GMT timezone .. maybe?

And yeah .. for .NET please.

cheers!

(thanks OpenID for using ZoneInfo instead of GMT timezones :( )

Update

I found this page which describes the relationship between a Zone and Lat/Long. Is it therefore possible (eg. anyone want to suggest some code examples?) how, using a Lat Long, determine the correct ZoneInfo?

+1  A: 

That is call Geolocalization and they are several products around. Mostly this is a paid service.

You can try this one... its free. :)

Lucas
Nice link and db :) but ... it's not giving me any ZoneInfo information. So i get a Lat/Long. Can i convert that into a ZoneInfo?
Pure.Krome
Im not sure what you meen by "ZoneInfo".... This is what that webservice realy outputs:http://iplocationtools.com/ip_location_api.phpIf that doesnt help I think you'll gonna have to customize the db...Again, there are several paid products. For that you better consult your ISP.
Lucas
If you're not sure what ZoneInfo is, then you might not understand the question properly. As such, I've updated the initial post btw.
Pure.Krome
I see. Oslon has a dll that you can install inside the .net gac. Here is some info:http://www.codeproject.com/KB/dotnet/Using_time_zones_in_NET.aspx
Lucas
+1  A: 

I created my own service to give me the ISP and Country from an IP

you can try it here

I can share the code, if this is what you want.


New answer

Why do you want the TimeZone from an IP Address? Why do you need the IP Address for? You can easyly get the OffSet time from the client.

I just implemented the code and it outputs the correct GMT timezone.

balexandre
ooo! interesting. Bummer that i'm behind a proxy .. not sure if that's sending my LAN Ip (10.0.1.x) I'll try at home where my ip is not getting fraked.
Pure.Krome
It's only the way I get the IP... you can see the ServerVariables object if you go to http://www.balexandre.com/sessions.aspx you will have the different IP's there... try it.
balexandre
Because i'm using OpenId and they have tz/Olsen times as their timezone implimentation. Now, if the user hasn't provided that, I wish to auto-select the closest timezone to the current connection ... which is why i'm guessing i need to do this via IP Address.
Pure.Krome
but as you can see from my code, your guess is wrong, you should get their local time and use the Offset to get the timeZone, with that conversion list in a XML, for example, you can get what you need to implement. I wonder why do you need the dropdown, should't be easy to login just like StackOverflow does? just the openID and that's it? Are you using the OpenID Library for .NET: http://wiki.openid.net/Libraries called DotNetOpenID @ http://dotnetopenid.googlecode.com/ ?
balexandre