时间转换处理

2023-05-05  本文已影响0人  苏苡

// 方法引用

createTime:‘20210422193807’

<span class="line-height-32">{{ timeFormatter(createTime) }}</span> 

········时间返回: '20210422193807' ====>   

················最后得到:  '2021-04-22 19:38:07'

// 时间截取方法:

timeFormatter(cellValue) {

              return `${cellValue.slice(0, 4)}-${cellValue.slice(4, 6)}-${cellValue.slice(6, 8)} ${cellValue.slice(8, 10)}:${cellValue.slice(10, 12)}:${cellValue.slice(12, 14)}`;

 },

// 时间截取: 

createTime:‘1678350978000 ’

<span v-if="createTime" v-date-format="createTime" />

········返回时间(时间戳):‘ 1678350978000 ’

···············最后得到:  ' 2023-3-9 16:36:18 '

上一篇下一篇

猜你喜欢

热点阅读