Countdown
function countDown(time) { var nowTime = +new Date(); var futureTime = +new Date(time); var times = (futureTime - nowTime) / 1000; var d = parseInt(times / 60 / 60 / 24); d = d < 10 ? '0' + d : d; var h = parseInt(times / 60 / 60 % 24); h = h < 10 ? '0' + h : h; var m = parseInt(times / 60 % 60); m = m < 10 ? '0' + m : m; var S = the parseInt (Times% 60 ); S = S <10 '0' +? S: S; return D + 'day' + h + 'when' + m + 'points' + s + 's' ; } the console.log (the countDown ( '2020-04-02 23:20:00'));
current time
<body> <div ID = "a Date"> </ div> <Script type = "text / JavaScript"> the setInterval ( function () { var DATE = new new a Date (); var year = the Date.getFullYear (); // get the current year var Mon = date.getMonth () + 1; // get the current month var DA = date.getDate (); // get the current date var day = date.getDay (); // get the current day of the week var H date.getHours = (); // Get hours var m = date.getMinutes (); // Get minutes var S = date.getSeconds (); // Get second var D = document.getElementById ( 'a Date' ); d.innerHTML = 'Current Time:' + year + 'of' + Mon + 'month' + DA + 'Day' + 'week' Day + + '' + H + ':' + m + ':' + S; }, 1000 ) </ Script>