Javascript:
Function systemDate (){
// Obtain the system time
Var date = new Date (); www.2cto.com
Var month = date. getMonth () + 1; // month defaults to 0-11, so add 1
Var minutes = date. getMinutes (), Min;
Var seconds = date. getSeconds (), updateTime;
UpdateTime = 60-seconds;
Minutes <= 9? Min = "0" + minutes: Min = minutes;
Var week = date. getDay (), day;
Switch (week ){
Case 1: day = "Monday"; break;
Case 2: day = "Tuesday"; break;
Case 3: day = "Wednesday"; break;
Case 4: day = "Thursday"; break;
Case 5: day = "Friday"; break;
Case 6: day = "Saturday"; break;
Case 7: day = "Sunday"; break;
}
Var time = date. getFullYear () + "/" + month + "/" + date. getDate () + "" + date. getHours () + ":" + Min + "" + day;
$ ("# UpdateTime"). text (time); // jquery
// Var container = document. getElementById ("updateTime ");
// Container. innerText = time; // javascript;
SetTimeout ('systemdate () ', updateTime * 1000); // scheduled request time
}
HTML
<Div id = "updateTime"> </div> // container for displaying the digital clock
You can set the container style (* ^__ ^ ...... Attach the one used in the project (note: the week is not displayed)
As follows:
From: html5