In web applications user can visit your site from anywhere in the world so we need to display the time according to their location i mean user’s local time. It is not possible to check user’s time on location base at server end .I was looking for the solution so that i can display time according to the user’s location So i fount JSTZ.js to get the timezone string By which we can check the time on server end with the help of cookies.

var timezone = jstz.determine();
document.cookie="local_timezone="+timezone.name(); //save the timezone name in cookies

no we can use global method $_COOKIE to fetch this name

$date='10-12-2015 3:45:10'; // you can pass date to convert 
convertToLocaltime($date);
function convertToLocaltime($date,$format=null)
{
        $timezon=isset($_COOKIE['local_timezone'])? $_COOKIE['local_timezone'] : 'Asia/Gaza';
	$date = new DateTime($date, new DateTimeZone('UTC'));
	$date->setTimezone(new DateTimeZone($timezon));
	if($format)
	return $date->format($format);
	else
	return $date->format(yii::app()->params['dateformat'].' h:i A');
}

no this function will return the date according to the user location . I.e if your server is in USA and user location is India then this will return date according to IST

http://codingbin.com/wp-content/uploads/2016/01/world_clock.jpghttp://codingbin.com/wp-content/uploads/2016/01/world_clock-150x150.jpgdevidjavascriptjQueryphplocal time,localtime,visitor timeIn web applications user can visit your site from anywhere in the world so we need to display the time according to their location i mean user's local time. It is not possible to check user's time on location base at server end .I was looking for the solution...coding, php, wordpress, yii, cakephp, and  jquery

Are you want to get implementation help, or modify or extend the functionality of this script? Submit paid service request