Javascript to print the current time implementation ideas and code
<html><head><title></title><script>/*//The statement of timevar date = new Date();alert(date);//The current timealert(date.toLocaleString());//Converts to local timealert(date.getFullYear());//According to the yearalert(date.getMonth() + 1);//It shows the month 0 to 11, so you have to add 1alert(date.getDate());//Displays the date in Januaryalert(date.getDay());//Displays the date of the week and the day of the weekalert(date.getHours());//Acquire hour timealert(date.getMinutes());//Get the current minutealert(date.getSeconds());//Gets the current number of secondsalert(date.getMilliseconds());//Gets the current number of millisecondsalert(date.getTime());//Gets the value of the milliseconds from midnight on January 1, 1970, to the current time*///Obtain year, month, day, hour, minute and second respectivelyvar myDate = new Date();var year = myDate.getFullYear();var month = myDate.getMonth() + 1;var date = myDate.getDate();var hours = myDate.getHours();var minutes = myDate.getMinutes();var seconds = myDate.getSeconds();//Months are shown in double digits such as Septemberif(month < 10 ){month = "0" + month;}if(date < 10 ){date = "0" + date;}//Time togethervar dateTime = year + " years " + month + " month " + date + " day " + hours + " when " + minutes + " points " + seconds + " seconds ";document.write(dateTime);// print The current time</script></head><body><!-- Incident response --><input type ="button" value="click" onclick="show()"/></body></html>