We usually encounter the problem of display time in the project. The general processing method is to control the display time through JS at the front end, and the Code for controlling the display time by JS is as follows: [javascript] function Clock () {var date = new Date (); this. year = date. getFullYear (); this. month = date. getMonth () + 1; this. date = date. getDate (); this. day = new Array ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday") [date. getDay ()]; this. hour = date. getHours () <10? "0" + date. getHours (): date. getHours (); this. minute = date. getMinutes () <10? "0" + date. getMinutes (): date. getMinutes (); this. second = date. getSeconds () <10? "0" + date. getSeconds (): date. getSeconds (); this. toString = function () {return "now:" + this. year + "year" + this. month + "month" + this. date + "day" + this. hour + ":" + this. minute + ":" + this. second + "" + this. day ;}; // It is <span id = "clock"> now: October 13, March 6, 2013 13:54:17 Wednesday </span> [javascript] <span> </span> this. toSimpleDate = function () {return this. year + "-" + this. month + "-" + this. date ;}; // 2013-03-06 this. toDetailDate = function () {return this. year + "-" + this. month + "-" + this. date + "" + this. hour + ":" + this. minute + ":" + this. second ;}; // 13:45:43 this. display = function (ele) {var clock = new Clock (); ele. innerHTML = clock. toString (); // call window in display mode. setTimeout (function () {clock. display (ele) ;}, 1000 );};}