可在后端处理
1.在实体类中加注解
在实体类中加入下列代码,我是这样处理的(我是在往前台传展示的时候发现的这个问题)
@JsonFormat(timezone = “GMT+8”,pattern = “yyyy-MM-dd HH:mm:ss”)
直接修改传值的时间戳。
2.前端处理
使用VUE elementui框架,在表格中直接处理对应的错误字段即可。
<el-table-column
prop="createDate"
align="center"
label="创建时间"
width="150">
<template slot-scope="scope" v-if="scope.row.createDate">
{{scope.row.createDate.toLocaleString().replace(/T/g, ' ').replace(/\.[\d]{3}Z/, '')}}
</template>
</el-table-column>
使用时注意加判断,v-if=“scope.row.createDate”
当前时间.replace(/T/g, ’ ').replace(/.[\d]{3}Z/, ’ ') 即可去掉T ;