开发中遇到Mybatis框架,直接返回带有datetime类型的对象时,显示的时间格式是不符合前端页面展示的标准
在该字段上加上
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date createdTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date updatedTime;
如果不行,在该字段Get方法上加注解.