gettime(dt) {
dt = Number(dt);
//时间戳十三位
let time = new Date(dt * 1000);
let y = time.getFullYear();
let m = time.getMonth() + 1;
let d = time.getDate();
let h = time.getHours();
let mm = time.getMinutes();
// let s = time.getSeconds();
return y + '-' + this.addtime(m) + '-' + this.addtime(d) + ' ' + this.addtime(h) + ':' + this.addtime(mm);
},
addtime(m) {
return m < 10 ? '0' + m : m;
}
js时间戳转换为日期格式
最新推荐文章于 2024-07-02 00:30:00 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)