js使用Moment.js进行时间格式转换

下载:

npm i moment

引入:

import moment from 'moment'

使用:

// 转换时间戳
formatDate(value) {
    
    
 const stamp = new Date(value)
 const time = moment(stamp).format('YYYY-MM-DD HH:mm:ss')
 return time
},

ok.

猜你喜欢

转载自blog.csdn.net/weixin_62733705/article/details/141321774