使用JQuery获取当前时间
年.月.日,星期,时:分:秒
$(function(){
setInterval(updateTime, 1000);
updateTime();
})
function updateTime() {
var date = new Date();
this.year = date.getFullYear();
this.month = date.getMonth() + 1;
this.date = date.getDate();
this.day = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六")[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();
var currentTime = this.year + "." + this.month + "." + this.date + "," + this.day+ ","+this.hour + ":" + this.minute + ":" + this.second ;
$("#date").html(currentTime);
}