functiongetYMDHMS(timestamp){//如果拿过来的时间戳是毫秒就不用了乘1000了let time =newDate(timestamp *1000);let year = time.getFullYear();const month =(time.getMonth()+1).toString().padStart(2,"0");const date = time.getDate().toString().padStart(2,"0");const hours = time.getHours().toString().padStart(2,"0");const minute = time.getMinutes().toString().padStart(2,"0");const second = time.getSeconds().toString().padStart(2,"0");return(
year +"-"+
month +"-"+
date +" "+
hours +":"+
minute +":"+
second
);}
前言非常实用的时间戳转为可读时间function getYMDHMS(timestamp) {//如果拿过来的时间戳是毫秒就不用了乘1000了 let time = new Date(timestamp * 1000); let year = time.getFullYear(); const month = (time.getMonth() + 1).toString().padStart(2, "0"); const date = time.getDate().to