// 时间戳转化
switchTime(Stamp) {
let timeStamp = Number(Stamp)
var time = new Date(timeStamp);
var y = time.getFullYear();
var m = time.getMonth() + 1;
var d = time.getDate();
var h = time.getHours();
var mm = time.getMinutes();
var s = time.getSeconds();
// 这里只返回年月日,如需要时分秒,自行拼接
return y + '-' + this.judgeNum(m) + '-' + this.judgeNum(d);
},
judgeNum(num) {
if (num < 10) {
return '0' + num
} else {
return num
}
},
时间戳转化
最新推荐文章于 2023-11-30 09:41:01 发布