// 创建 Date 对象并解析原始日期字符串 var originalDate = newDate(cellValue);
// 提取年、月、日、时、分、秒 var year = originalDate.getFullYear(); var month = (originalDate.getMonth() + 1).toString().padStart(2, '0'); var day = originalDate.getDate().toString().padStart(2, '0'); var hours = originalDate.getHours().toString().padStart(2, '0'); var minutes = originalDate.getMinutes().toString().padStart(2, '0'); var seconds = originalDate.getSeconds().toString().padStart(2, '0');
// 构建新的格式化日期字符串 var formattedDateString = `${year}-${month}-${day}${hours}:${minutes}:${seconds}`; return formattedDateString }