优化代码

This commit is contained in:
duan
2024-05-27 16:58:04 +08:00
parent d67ab4d9b6
commit 91d22d5e7d
9 changed files with 521 additions and 28 deletions

View File

@@ -91,7 +91,7 @@
const hour = date.getHours(); // 获取小时
const minute = date.getMinutes(); // 获取分钟
const second = date.getSeconds(); // 获取秒数
const formattedDate = `${year}-${month}-${day} ${hour}:${minute}:${second}`; // 拼接成格式化后的日期字符串
const formattedDate = `${year}-${month}-${day} ${hour.length==1? '0'+hour:hour}:${minute.length==1? '0'+minute:minute}:${second.length==1? '0'+second:second}`; // 拼接成格式化后的日期字符串
return formattedDate
}
},