my-programming-tutorials-logo

My Programming Tutorials

Server & Client Timezone difference problem? use this trick.

Last updated on by , no comments

Server & Client Timezone difference problem? use this trick.

First Grab user’s IP address Second Use bellow codes to fetch the timezone of users using their IP Address. $ip = “189.240.194.147”; // user’s IP Address $ipInfo = file_get_contents(‘http://ip-api.com/json/’ . $ip); $ipInfo = json_decode($ipInfo); $timezone = $ipInfo->timezone; Third Now its time to set the timezone in your PHP based script. Everyone know php execution starts… Read More »