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

2022年7月2日13:15:46

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;
  • 作者:IT小红袜
  • 原文链接:https://blog.csdn.net/weixin_53864161/article/details/121794082
    更新时间:2022年7月2日13:15:46 ,共 161 字。