Hi
I am trying to bypass the whole issue with a server being in one timezone and clients in the other by being a bit clever. Having the user choose a tiemzone froma dropdown isnt working for me - daylight savings etc always seems to screw the time up, so what I am doing is passing a hidden form variable when the user logs in that holds their local time (using javascript) and then the difference betwen their local time and the PHP server time becomes their time offset, added to every time they view from the database.
So
Login form has:
<input type=hidden name=clienttime>
and
<SCRIPT LANGUAGE="JavaScript"><!--
var now = new Date();
var epoch_seconds=Math.round(now.getTime()/1000);
document.form.clienttime.value=epoch_seconds;
//--></SCRIPT>
and I write a session variable called SESSION_TIMEOFFSET which is $clienttime-time();
This works fine on my local network, even when I change the server time. On our live environment (i'm in New Zealand, server is in USA), both clienttime and time() are the same! They're both the US server time! Deosnt javascript retrieve time from the local client machine? WHat am I missing here?
cheers
Lucas Young
I am trying to bypass the whole issue with a server being in one timezone and clients in the other by being a bit clever. Having the user choose a tiemzone froma dropdown isnt working for me - daylight savings etc always seems to screw the time up, so what I am doing is passing a hidden form variable when the user logs in that holds their local time (using javascript) and then the difference betwen their local time and the PHP server time becomes their time offset, added to every time they view from the database.
So
Login form has:
<input type=hidden name=clienttime>
and
<SCRIPT LANGUAGE="JavaScript"><!--
var now = new Date();
var epoch_seconds=Math.round(now.getTime()/1000);
document.form.clienttime.value=epoch_seconds;
//--></SCRIPT>
and I write a session variable called SESSION_TIMEOFFSET which is $clienttime-time();
This works fine on my local network, even when I change the server time. On our live environment (i'm in New Zealand, server is in USA), both clienttime and time() are the same! They're both the US server time! Deosnt javascript retrieve time from the local client machine? WHat am I missing here?
cheers
Lucas Young