function getPreDay(today){ let yesterday_milliseconds=today.getTime()-1000*60*60*24;//前一天 let yesterday=new Date(); yesterday.setTime(yesterday_milliseconds); let strYear=yesterday.getFullYear(); let strDay=yesterday.getDate(); let strMonth=yesterday.getMonth()+1; if(strMonth<10) { strMonth="0"+strMonth; } if(strDay<10) { strDay="0"+strDay; } let strYesterday=strYear+"-"+strMonth+"-"+strDay; return strYesterday }