0
Guys, can you help me... I’m learning to make a clock with Javascript...
But if to concatenate 0 in front of seconds, minutes and hours is not working... I can’t find the error...
var tempo=new Date();
var hora=tempo.getHours();
var min=tempo.getMinutes();
var seg=tempo.getSeconds();
var impressao=hora + ":" + min + ":" + seg;
if(hora<10){
hora="0" + tempo.getHours;
}
if(min<10){
min="0" + tempo.getMinutes;
}
if (seg<10){
seg="0" + tempo.getSeconds;
}
document.write(impressao);
thank you very much Nelson, helped me a lot!
– Kleber Stumpf