//获取前天-2,昨天-1,今天0,明天1等时间 yyyy/MM/dd format,分隔符 export function GetDateStr(AddDayCount, format, from) { var dd = !from ? new Date() : stringToDate(from,format); dd.setDate(dd.getDate() + AddDayCount); //获取AddDayCount天后的日期 var year = dd.getFullYear(); var month = dd.getMonth() + 1 < 10 ? "0" + (dd.getMonth() + 1) : dd.getMonth() + 1; var date = dd.getDate() < 10 ? "0" + dd.getDate() : dd.getDate(); return year + format + month + format + date; } //将时间戳转换成日期格式 export function timestampToTime(timestamp,type) { if(timestamp.length<13){ timestamp=timestamp*1000 }         var date = new Date(timestamp);//时间戳为10位需*1000,时间戳为13位的话不需乘1000         let Y = date.getFullYear() + '-';         let M = (date.getMonth()+1 < 10 ? '0'+(date.getMonth()+1) : date.getMonth()+1) + '-';         let D = date.getDate()<10?'0'+date.getDate():date.getDate();         let h = ' '+date.getHours() + ':';         let m = date.getMinutes() + ':';         let s = date.getSeconds(); if(type=='date'){ return Y+M+D; }else if(type=='time'){ return Y+M+D+h+m+s; }             }