var date = new Date();
console.log(date);
console.log(date.getFullYear());
console.log(date.getMonth() + 1);
console.log(date.getDate());
console.log(date.getDay()); //周日返回的是0
var year = date.getFullYear();
var month = date.getMonth() + 1;
var dates = date.getDate();
var day = date.getDay();
var h = date.getHours();
h = h < 10 ? '0' + h : h;
var m = date.getMinutes();
m = m < 10 ? '0' + m : m;
var s = date.getSeconds();
s = s < 10 ? '0' + s : s;
var arr = ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'];
console.log('今天是' + year + '-' + month + '-' + dates + ' ' + h + ':' + m + ':' + s + ' ' + arr[day]);
console