I am able to fetch the value, but only when I refresh the browser twice. If I change my current system time, and refresh the page, I still see the old time; when I refresh again, then I see the updated time.
var now=new Date(); currTime=now.getHours(); document.cookie = "currentTime = " +currTime;
$current_time = $_COOKIE["currentTime"]; echo $current_time;
As I said, I am able to get the updated value of current time from cookie but only if I refresh twice.
What could be the problem?