Question: here i have this code if i want to clock in12 hour + also when it morning show text in pic good morning else gd
here i have this code if i want to clock in12 hour + also when it morning show text in pic good morning else gd evening depend on the time
plz fix it by using java scripts and explain it
function clock() {
const fdate = new Date();
//method get hour etc ..
var hours = fdate.getHours();
var min = fdate.getMinutes();
var sec = fdate.getSeconds();
if (hours < 10) {
hours = "0" + hours;
}
if (min < 10) {
min = "0" + min;
}
if (sec < 10) {
sec = "0" + sec;
}
document.getElementById('hour').innerHTML = hours;
document.getElementById('mint').innerHTML = ":" + min;
document.getElementById('second').innerHTML = ":" + sec + "";
}
setInterval(clock, 100);
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
