How to manage timezones between users in different location

In this video I have shown how we can manage timezones in users. If your web application is being accessed from different locations which is having different timezones, Our application should manage to show the time according to the user.

In this example to get the timezone of users we are getting help of an online web service ipinfodb.com. There might be many other ways to get the time zone that you can use your own way.We are using the universal time format UTC in our application. After getting the time zone offset of the user, we are adding the offset with the UTC time to get the actual time of the user.

The above page is accessing MySQL database to show the values as shown in the video.
db_config.php is given below to access the MySQL database.

An example is that is not accessing MySQL database is shown below.

This example is hosted in the below link. You can check your timezone and offset there. And the local time is shown according the local offset.
http://technobudy.com/handle_time_zone.php

41 views