function 时间程序() { var date = new Date(); var year = date.getFullYear(); var month = 时间格式化(date.getMonth() + 1,2); var day = 时间格式化(date.getDate(),2); var week = "星期" + "日一二三四五六".charAt(date.getDay()); var hour = 时间格式化(date.getHours(),2); var minute = 时间格式化(date.getMinutes(),2); var second = 时间格式化(date.getSeconds(),2); var Milliseconds = 时间格式化(date.getMilliseconds(),3); var currentTime = year + "-" + month + "-" + day + " " + hour + ":" + minute + ":" + second + "." + Milliseconds + " " + week ; setInterval("时间程序()", 100); return currentTime; } function 时间格式化(参数, 位数) { return (Array(位数).join(0) + 参数).slice(-位数) }