getLocalTime(time) {
if (!time) return "";
const date =new Date(time)//按照传入的时间进行转化
//const date = new Date(time+604800000);//按照传入的时间后的七天进行转化,注意
const Y = date.getFullYear();
const M = `${(date.getMonth() + 1)}`.padStart(2, "0");
const D = `${date.getDate()}`.padStart(2, "0");
const h = `${date.getHours()}`.padStart(2, "0");
const m = `${date.getMinutes()}`.padStart(2, "0");
const s = `${date.getSeconds()}`.padStart(2, "0");
return `${Y}-${M}-${D} ${h}:${m}:${s}`;
}
将时间戳转换成YYYY-MM-DD HHMMSS
于 2023-11-28 16:25:10 首次发布