【js】时间戳转时间 1680338700 =》2023-04-01 16:45:00
1 transformTimestamp (timestamp) { 2 let date = new Date(parseInt(timestamp) * 1000) 3 let Year = date.getFullYear() 4 let Moth = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) 5 let Day = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate()) 6 let Hour = (date.getHours() < 10 ? '0' + date.getHours() : date.getHours()) 7 let Minute = (date.getMinutes() < 10 ? '0' + date.getMinutes() : date.getMinutes()) 8 let Sechond = (date.getSeconds() < 10 ? '0' + date.getSeconds() : date.getSeconds()) 9 let GMT = Year + '-' + Moth + '-' + Day + ' ' + Hour + ':' + Minute + ':' + Sechond 10 11 return GMT 12 },