This question already has an answer here:
I'm using .NET and I'm able to geolocate user city by IP.
Is there easy way to get user timezone by long. and lat. or city name?
I wonder how facebook is doing it?
Thank You
This question already has an answer here:
I'm using .NET and I'm able to geolocate user city by IP.
Is there easy way to get user timezone by long. and lat. or city name?
I wonder how facebook is doing it?
Thank You
There is a web service you can use to get the timezone by city or longitude and latitude:
http://www.earthtools.org/webservices.htm#timezone
You can get a list of timezones from the system and compare it to the city name:
http://msdn.microsoft.com/en-us/library/bb397781.aspx
Which is fragile.
Alternatively there are a few web services out there you can use, passing it long/lat and it gives you timezone, but that means you're tethered to the third part web service.
I'm sure this code can be simplified, but this worked for me to get the TimeZone ID and Name.