Add padding to hours and minutes of UTC time when updated by Javascript #4

Merged
deepend merged 1 commits from :master into master 2020-07-02 02:28:11 +00:00
1 changed files with 1 additions and 1 deletions

View File

@ -63,7 +63,7 @@ let months = ["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov",
let daysOfWeek = ["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];
function update_date() {
var d = new Date();
document.getElementById("utcdate").innerText = daysOfWeek[d.getUTCDay()]+" "+months[d.getUTCMonth()]+" "+d.getUTCDate().toString()+" "+d.getUTCHours().toString()+":"+d.getUTCMinutes().toString();
document.getElementById("utcdate").innerText = daysOfWeek[d.getUTCDay()]+" "+months[d.getUTCMonth()]+" "+d.getUTCDate().toString()+" "+d.getUTCHours().toString().padStart(2,'0')+":"+d.getUTCMinutes().toString().padStart(2,'0');
setTimeout(update_date,15000);
}
setTimeout(update_date,15000);