My Programming Tutorials

My Programming Tutorials

Server & Client Timezone difference problem? use this trick.

Last updated on by , no comments


Grab user’s IP address


Use bellow codes to fetch the timezone of users using their IP Address.

$ip       = ""; // user's IP Address
$ipInfo   = file_get_contents('' . $ip);
$ipInfo   = json_decode($ipInfo);
$timezone = $ipInfo->timezone;


Now its time to set the timezone in your PHP based script. Everyone know php execution starts from index.php file.

So we just need to set the timezone code in the starting line of index.php file.


Thats all! enjoy!

Author Info

Paritosh Pandey

He loves Technology


Leave a Reply

Your email address will not be published. Required fields are marked *