let date =newDate(parseInt(param));// 13位let date =newDate(parseInt(param)*1000)// 10位
var timeStamp = xxxx //这里为当前时间戳// 时间戳转换为日期格式let date =newDate(parseInt(timeStamp));let y = date.getFullYear();let m = date.getMonth()+1;
m = m <10?('0'+ m): m;let d = date.getDate();
d = d <10?('0'+ d): d;let h = date.getHours();
h = h <10?('0'+ h): h;let minute = date.getMinutes();let second = date.getSeconds();
minute = minute <10?('0'+ minute): minute; second = second <10?('0'+ second): second;// console.log( y + '-' + m + '-' + d + ' ' + ' ' + h + ':' + minute + ':' + second) let dates = y +'-'+ m +'-'+ d +' '+' '+ h +':'+ minute +':'+ second;
console.log(dates)
10位、13位时间戳转换成日期格式JS此处parama为我们需要交换的时间变量10位时间戳需要*100013位不需要let date = new Date(parseInt(param)); // 13位let date = new Date(parseInt(param) * 1000) // 10位var timeStamp = xxxx //这里为当前时间戳 // 时间戳转换为日期格式 let date = new Date(parseInt(time