比如当前系统时间是 2024/2/26 14:03:50,需要改成字符串 202402026140350
// 输出当前系统时间的格式化字符串
function formattedSystemDate () {
const currentDate = new Date();
const year = currentDate.getFullYear();
const month = String(currentDate.getMonth() + 1).padStart(2, '0');
const day = String(currentDate.getDate()).padStart(2, '0');
const hours = String(currentDate.getHours()).padStart(2, '0');
const minutes = String(currentDate.getMinutes()).padStart(2, '0');
const seconds = String(currentDate.getSeconds()).padStart(2, '0');
const formattedDate = `${year}${month}${day}${hours}${minutes}${seconds}`;
return formattedDate
}