Hello All and Greetings,
I'm working on an assignment which determines the client timezone offset , passes the same to a PHP script, which contains a code to fetch the timezone identifier for that client's area.
Now for determining timezone offset, I have used JavaScript. However, I need some way to pass this to PHP. I used AJAX call for the same.
var url = "index.php";
url=url+"?client_timezoneoffset="+offset;
xmlhttp.open("GET",url,true);
xmlhttp.send(true);
This JavaScript I'm calling onload of index.php. But still $_GET comes empty. I twisted this implementation and called another page set_client_timezone.php where to my surprise, $_GET contained the timezone. I then stored it in $_SESSION.
When I did an all-round testing of the application, to my surprise, the timezone changes were getting reflected on SECOND load of the page.
i.e. first time I navigated to http://www.example.com/index.php, it showed me time in UTC, but when I reloaded, it showed me correct time as per my timezone - Asia/Calcutta.
Can anyone of you guys out there suggest me a way out of this paradox ?
Can anyone point me a standard way of achieving the same (I'm ready to rollback my current implementation)
I'm posting in this forum for the first time and so heartfelt apologies if my post flouted any rule of this forum.
Cheers,
Abhijit.