Hello,
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
Hello,
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
If the code is executed on the user PC you can use TimeZone.CurrentTimeZone property to get the time zone of the current computer.
I believe that websites use PHP or JavaScript to get the user time zone, or simply they ask the user, for example when he/she registers a new account.
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.
There is a web service you can use to get the timezone by city or longitude and latitude: