Hi. Here is code for a simple JavaScript Timer. My Problem is, that the soconds are junping back to "0" instead of "60,61,62...". How can modify this code, so that the seconds are not jumping back to "0" after "59". var zeitintervall = null; var timer = null; function Uhr() { var Jetzt = new Date(); var myTime = new Date(Jetzt - StartTime); var seconds = myTime.getSeconds(); if(seconds < 10){ seconds = "0"+seconds; } var millis = myTime.getMilliseconds().toString(); document.getElementById('counter').innerHTML = seconds + ':' + millis.substr(0,2); timer=setTimeout("Uhr()", 20); zeitintervall = myTime; } function StartStop(){ StartTime = new Date(); timer = setTimeout("Uhr()", 20); } PHP:
Replace var seconds = myTime.getSeconds(); With var seconds = myTime.getHours()*3600 + myTime.getMinutes()*60 + myTime.getSeconds(); There may be a better way of doing it, I'm still learning this stuff