The javascript page dynamically displays the time varying sample code
<html><head><title></title><script>function getDateDemo(){/*//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 timevar divNode = document.getElementById("time");divNode.innerHTML = dateTime;}window.setInterval("getDateDemo()",1000);//Call getDateDemo() every 1 second</script></head><body><div id="time"></div></body></html>