getTime (myDate) {
console.log(123);
let date = new Date(myDate * 1000)
let Y = date.getFullYear() + '-';
let M = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1) + '-';
let D = date.getDate() + ' ';
let h = date.getHours();
let m = date.getMinutes();
let s = date.getSeconds();
if (D < 10) {
D = '0' + D
}
if (h < 10) {
console.log(1);
h = '0' + h
}
if (m < 10) {
m = '0' + m
}
if (s < 10) {
s = '0' + s
}
return Y + M + D + h + ':' + m + ':' + s
},
JS——时间格式转化(年-月-日-时-分-秒)
于 2021-08-30 14:21:53 首次发布