1. Knowing the start time and the total number of seconds, we have calculated the countdown of hours, minutes and seconds. TS;
2. The output is 24 br 24 14 50, and what I want to achieve is a countdown to it;
countdown
<p class="groupText_2"><b -sharphour>00</b>:<b -sharpminute>00</b>:<b -sharpsecond>00</b>
TS:
//DOMJSDOM,HTML-sharphour/-sharpminute/-sharpsecond
@ViewChild("hour") hour: ElementRef;
@ViewChild("minute") minute: ElementRef;
@ViewChild("second") second: ElementRef;
var secondTime = 87890;//
var minuteTime = 0;//
var hourTime = 0;//
if (secondTime > 60) {//60
//60
minuteTime = Math.floor(secondTime / 60);
//
secondTime = Math.floor(secondTime % 60);
//60
if (minuteTime > 60) {
//60
hourTime = Math.floor(minuteTime / 60);
//60
minuteTime = Math.floor(minuteTime % 60);
}
}
var resultTime = "" + Math.floor(secondTime);
if (minuteTime > 0) {
resultTime = "" + Math.floor(minuteTime) + ":" + resultTime;
}
if (hourTime > 0) {
resultTime = "" + Math.floor(hourTime) + ":" + resultTime;
}
console.log(resultTime);
//
this.second.nativeElement.innerHTML = Math.floor(secondTime);
//
this.minute.nativeElement.innerHTML = Math.floor(minuteTime);
//
this.hour.nativeElement.innerHTML = Math.floor(hourTime);