GetDateStr(AddDayCount) {
const dd = new Date();
dd.setDate(dd.getDate()+AddDayCount);//获取AddDayCount天后的日期
const y = dd.getFullYear();
const m = dd.getMonth()+1;//获取当前月份的日期
const d = dd.getDate();
console.log(y+"-"+m+"-"+d);
return y+"-"+m+"-"+d;
}
this.GetDateStr(-1);
this.GetDateStr(0);
this.GetDateStr(1);
image.png
网友评论