Determining time zone a web site visitors time zone

Recently I faced a challenge to write a server side script in .NET to determine a users’ time zone. This was coming from a client in UK who was having a high traffic web site and he wanted an efficient way to determine the time zone of a user. The main condition was that it could not use any client side scripting and that it had to be very efficient.

After searching the web I realized that there were no free services that provided this kind of service. There were a few that did this for a fee.

But there were a few services that provided the visitors country based on the IP of the visitor. So I went ahead and proposed a solution where the country was discovered through one of these free services or a database and then to construct a database that contained time zones and countries.

So I used the free web service at http://www.hostip.info to determine the country and then used my database to discover the time zone. this solution worked perfectly.

But the client refused to accept it because it consumed a web service. He insisted that consuming the web service will eat up his band width and that it was not feasible for him. Then I was searching around and came across the GeoIP lookup database that is being used in the DotNetNuke portal. Since this was a free database, I then changed my implementation to use this.

And I used caching to improve the performance and this was accepted by my client. Thanks Official Project Base!


  1. It’s going to be end of mine day, but before finish I am
    reading this fantastic article to improve my know-how.




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



%d bloggers like this: