RN-昨天、今天、明天
2018-01-04 本文已影响25人
精神病患者link常
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);
![](https://img.haomeiwen.com/i23011/4b8fdacd6e897a54.png)