Printing The current time there are many ways, in this article for you to describe the use of JavaScript is how to do, specifically implemented as follows, interested friends can refer to the following
Copy code code as follows: <html> <head> <title></title> <script> /* //Declaration time var date = new Date (); alert (date);/Current time alert (date.tolocalestring ());/ Convert to local time alert (date.getfullyear ());//Show Year alert (Date.getmonth () + 1);//Show month 0-11, you need to add 1 alert ( Date.getdate ())//display January date alert (Date.getday ());//Display the date of the week, Week alert (date.gethours ());/Get hour time Alert (Date.getminutes ());//Get the current minute alert (date.getseconds ());//Get the current number of seconds alert (date.getmilliseconds ());// Gets the current number of milliseconds alert (date.gettime ());//Gets the millisecond value */ /////////////////////////////////////////min = new Date (); var year = mydate.getfullyear (); var month = Mydate.getmonth () + 1; var Date = mydate.getd Ate (); var hours = mydate.gethours (); var minutes = mydate.getminutes (); var seconds = mydate.getseconds (); //month display as two digits as September if (month <) { month ="0" + month; } if (date <) { date = "0" + date; } //Time stitching var dateTime = ye AR + "Year" + Month + "Month" + Date + "Day" + Hours + "time" + minutes + "min" + seconds + "SEC"; document.write (dateTime); /print Current time </script> </head> <body> <!-- Event response--> <input type = "button" value= "click" onclick= "Show ()"/> </body> </ html>