Get System Current Time
<! DOCTYPE HTML PUBLIC "-//w3c//dtd HTML 4.01 transitional//en" ><html> <head> <title>Test08.html</title> <script type="Text/javascript"> function showTime(){ vartoday=New Date();varYear=today.getfullyear ();varMonth=today.getmonth () +1;varDate=today.getdate ();varHour=today.gethours (); Hour=checktime (hour);varShangxia="Morning";if(hour> A) {shangxia="Afternoon"; hour=hour- A; }varMinute=today.getminutes (); Minute=checktime (minute);varSecond=today.getseconds (); Second=checktime (second);varDay=today.getday ();varWeekdaySwitch(day) { Case 0: weekday="Sunday"; Break; Case 1: weekday="Monday"; Break; Case 2: weekday="Tuesday"; Break; Case 3: weekday="Wednesday"; Break; }varcurrenttime=year+"Year"+month+"Month"+date+"Day"+hour+":"+minute+":"+second+" "+shangxia+" "+weekday; document.getElementById ("Time"). Innerhtml=currenttime; } function checktime(t){ if(t<Ten) {t="0"+t; }returnT } setinterval ("ShowTime ()", +);</script> </head> <body> <div id="Time"></div> </body></html>
JavaScript-Gets the current time of the system