function fun_date(aa){
var date1 = new Date(),
time1=date1.getFullYear()+"-"+(date1.getMonth()+1)+"-"+date1.getDate();//time1表示当前时间
var date2 = new Date(date1);
date2.setDate(date1.getDate()+aa);
var time2 = date2.getFullYear()+"-"+(date2.getMonth()+1)+"-"+date2.getDate();
console.log(time2)
}
fun_date(0);
fun_date(1);
fun_date(2);
fun_date(3);
fun_date(4);
fun_date(5);
fun_date(6);
alert(getWeekday('2017-08-26'))
function getWeekday(sDate){
var dt = new Date(sDate.replace(/-/g, '/'));
var a = ['星期日', '星期一','星期二','星期三','星期四','星期五','星期六'];
return a[dt.getDay()];
}
var date = new Date();
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
if(month < 10){
month = String(String(0) + String(month));
}
if(day < 10){
day = String(String(0) + String(day));
}
time1=String(day)+"/"+String(month)+"/"+String(year);//time1表示当前时间加0
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
if(month < 10){
month = String(String(0) + String(month));
}
if(day < 10){
day = String(String(0) + String(day));
}
time1=String(day)+"/"+String(month)+"/"+String(year);//time1表示当前时间加0