js 格式化时间 供页面使用
let date = new Date(1648605053000) //后面3个零自己补上去 才是对的时间 console.log(date.getFullYear()); console.log(date.getHours()); console.log(date.getMonth()); console.log(date.getDate());//哪一天 console.log(date.getDay());//星期几 var week = ['星期天','星期一','星期二','星期三','星期四','星期五','星期六'] //完全版 console.log(date.getFullYear()+'-'+(date.getMonth()+1)+'-'+date.getDate()+week[date.getDay()]+'-'+date.getHours()+'点');