Is there any server or client side way to determine their location and get the local time.
I'd like it to also update in real time, e.g. hour, mins, secs.
I'd prefer it if I can use PHP / JavaScript (jQuery included) or something like that.
Is there any server or client side way to determine their location and get the local time.
I'd like it to also update in real time, e.g. hour, mins, secs.
I'd prefer it if I can use PHP / JavaScript (jQuery included) or something like that.
You may want this
setInterval(function(){
var dt=new Date(), h=dt.getHours(), m=dt.getMinutes(), s=dt.getSeconds(),
curTime= pad(h)+':'+pad(m)+':'+pad(s);
document.getElementById('time').innerHTML=curTime;
}, 500);
function pad(n) { return ("0" + n).slice(-2); }
DEMO.
You can try using jquery localtime plugin. Take a look [here]: http://code.google.com/p/jquery-localtime/wiki/Usage
In JavaScript you can easily get the current date and time using the Date object;
var now = new Date();
This will get the local client machine time.