SpringBoot中的Mysql时间类型dateTime格式转换配置

5次阅读
没有评论

1、yml全局配置

spring:
  jackson:
    date-format: yyyy-MM-dd HH:mm:ss
    time-zone: GMT+8

2、实体类中单个字段配置

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createTime;
正文完
 0