首页 > 代码库 > 获取n天后的日期

获取n天后的日期

getDateAfter_n(days){
let date = new Date();
date.setDate(date.getDate() + days);
let yearStr = date.getFullYear();
let monthStr = ("0"+(date.getMonth()+1)).slice(-2, 8);
let dayStr = ("0"+date.getDate()).slice(-2, 8);
let result = "";
result = yearStr+‘-‘+monthStr+‘-‘+dayStr;
return result;
}

获取n天后的日期