web网站显示当前时间

var week = new Array("星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六");
var now = new Date();
var year = now.getFullYear();
var month = now.getMonth() + 1;
var day = now.getDate();
var weekDay = now.getDay();
$("#indexDate").html("今天是:"+year + "年" + month + "月" + day + "日" + " " + week[weekDay]);

你可能感兴趣的:(小方法)