export function formatDate(date) { const year = date.getFullYear() const month = (date.getMonth() + 1).toString().padStart(2, '0') // 月份加1,并补零 const day = date.getDate().toString().padStart(2, '0') // 日期补零 const hours = date.getHours().toString().padStart(2, '0') // 小时补零 const minutes = date.getMinutes().toString().padStart(2, '0') // 分钟补零 const seconds = date.getSeconds().toString().padStart(2, '0') // 秒数补零 return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}` }