Removed the orignal PHP date formating. The code now runs so that PHP will inishilize a view on the page and JS will then update this. The formating of the Timezone doesn't seem to be consistant acrossed browsers. And JS doesn't format time with leading zeros for minutes or seconds which is odd. This may be fixed in a further revision.
15 lines
406 B
JavaScript
15 lines
406 B
JavaScript
|
|
window.onload = startInterval;
|
|
function startInterval(){
|
|
setInterval("startTime();",1000);
|
|
}
|
|
|
|
function startTime(){
|
|
var current_time = new Date(),
|
|
formated_time = current_time.getHours() + ":"
|
|
+ current_time.getMinutes() + ":"
|
|
+ current_time.getSeconds();
|
|
document.getElementById('time_title').innerHTML = "Time is: " + formated_time;
|
|
document.getElementById('time_body').innerHTML = Date();
|
|
}
|