Vue——时间戳转换成年月日时分秒
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();v
·
蒽,没错,再次记录一下
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 },
更多推荐
已为社区贡献1条内容
所有评论(0)