< ;title>
<script> <br>function getDateDemo(){ <br>/* <br><br>//Declaration time<br>var date = new Date( ); <br>alert(date);//Current time<br>alert(date.toLocaleString());//Convert to local time<br>alert(date.getFullYear());//Display year<br>alert(date.getMonth() 1);//Display month 0-11, need to add 1 <br>alert(date.getDate());//Display the date in January <br>alert(date.getDay ());//Display the date of the week, day of the week<br>alert(date.getHours());//Get the hour time<br>alert(date.getMinutes());//Get the current minutes<br> alert(date.getSeconds());//Get the current number of seconds<br>alert(date.getMilliseconds());//Get the current number of milliseconds<br>alert(date.getTime());//Get from At midnight on January 1, 1970, the millisecond value to the current time <br>*/ <br>//Get the year, month, day, hour, minute, and second respectively <br>var myDate = new Date(); <br>var year = myDate.getFullYear(); <br>var month = myDate.getMonth() 1; <br>var date = myDate.getDate(); <br>var hours = myDate.getHours(); <br>var minutes = myDate.getMinutes(); <br>var seconds = myDate.getSeconds(); <br><br>//The month is displayed as two digits such as September <br>if(month < 10 ){ <BR>month = "0" month; <BR>} <BR>if(date < 10 ){ <BR>date = "0" date; <BR>} <br><br>//Time Splice <BR>var dateTime = year "year" month "month" date "day" hours "hour" minutes "minute" seconds "second"; <br><br>//document.write(dateTime);//print Current time<br><br>var divNode = document.getElementById("time"); <BR>divNode.innerHTML = dateTime; <br><br>} <BR>window.setInterval("getDateDemo()",1000 );//Every second, call getDateDemo() <BR></script>