SOURCE

// 日期格式化
let nowDate =new Date();
let nowTime=nowDate.getFullYear()+'-'+((nowDate.getMonth()+1)<10?"0"+(nowDate.getMonth()+1):(nowDate.getMonth()+1))+'-'+(nowDate.getDate()<10?"0"+nowDate.getDate():nowDate.getDate())+' '+(nowDate.getHours()<10? "0"+nowDate.getHours():nowDate.getHours())+':'+(nowDate.getMinutes()<10?"0"+nowDate.getMinutes():nowDate.getMinutes())+':'+(nowDate.getSeconds()<10?"0"+nowDate.getSeconds():nowDate.getSeconds());
console.log(nowTime)
console.log(nowDate.getMonth()<10)

let nowTime2=nowDate.getFullYear()+'-'+((nowDate.getMonth()+1)<10?"0"+(nowDate.getMonth()+1):(nowDate.getMonth()+1))+'-'+(nowDate.getDate()<10?"0"+nowDate.getDate():nowDate.getDate())
console.log(nowTime2)
console 命令行工具 X clear

                    
>
console