timeFormat(timestamp){
var time = new Date(timestamp);
var year = time.getFullYear();
var month = time.getMonth()+1;
var date = time.getDate();
var hours = time.getHours();
var minutes = time.getMinutes();
var seconds = time.getSeconds();
return year + '-' + this.addZero(month) + '-' + this.addZero(date) + ' ' + this.addZero(hours) + ':' + this.addZero(minutes) + ':' + this.addZero(seconds)
},
addZero(num) { return num < 10 ? '0' + num : num },
时间戳转变年月日
最新推荐文章于 2024-07-02 00:30:00 发布