js获取当前日期与星期

var currentDate = new Date();
var weekday = ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"];
document.write(
currentDate.getFullYear() + "年" +
(currentDate.getMonth() + 1) + "月" +
currentDate.getDate() + "日" + " " +
weekday[currentDate.getDay()]
);

posted @ 2016-07-23 15:43  柳仙慧子  阅读(958)  评论(0编辑  收藏  举报