1. 程式人生 > >獲取n天後的日期

獲取n天後的日期

res date let after () ice days return 獲取

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天後的日期