I make a clock that works very fine. I want to know how it works. For this clock I use the function time() from JavaScript. I want to make a clock that put the same hour even if you are not in the same time zone. Someone can tell me if with this function I can do it or how I have to do it?
The JavaScript code
function muestraReloj() {
var fechaHora = new Date();
var horas = fechaHora.getHours();
var minutos = fechaHora.getMinutes();
var segundos = fechaHora.getSeconds();
if(horas < 10) { horas = '0' + horas; }
if(minutos < 10) { minutos = '0' + minutos; }
if(segundos < 10) { segundos = '0' + segundos; }
document.getElementById("reloj").innerHTML = horas+':'+minutos+':'+segundos;
}
window.onload = function() {
setInterval(muestraReloj, 1000);
}
Thank You