added leading zero to hours and minutes

master
Malte Kiefer 2020-10-16 07:33:29 +02:00 committed by GitHub
parent b8fdb2e5ef
commit 2eb134a8f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 8 additions and 0 deletions

View File

@ -7,6 +7,14 @@ function drawTimeDate() {
var d = new Date();
var h = d.getHours(), m = d.getMinutes(), day = d.getDate(), month = d.getMonth(), weekDay = d.getDay();
if (h < 10) {
h = "0" + h;
}
if (m < 10) {
m = "0" + h;
}
var daysOfWeek = ["SUN", "MON", "TUE","WED","THU","FRI","SAT"];
var hours = (" "+h).substr(-2);
var mins= ("0"+m).substr(-2);