I want to convert from UTC time to actual user timezone. realized through PHP can not do that. So I combined jQuery and PHP together.
I am attaching the code I wrote. Unfortunately something wrong but i dont know what and where is the problem.
Thanks in advance.
if(isset($_SESSION['timezone'])){
} else if(isset($_REQUEST['hiddenval'])) {
$_SESSION['timezone'] = $_REQUEST['hiddenval'];
header('Location: ' . $url);
} else {
echo '<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"></script>
<script type="text/javascript" src="//pellepim.bitbucket.org/jstz/jstz.min.js">
</script>
<script type="text/javascript">
$(document).ready(function(){
var timezone = jstz.determine_timezone();
document.getElementById("hiddenVal").value = timezone.name();
</script>';
}
echo $_SESSION['timezone'];