通过application.yml文件进行全局配置,配置信息如下。
spring:
jackson:
date-format: yyyy-MM-dd hh:mm:ss
time-zone: GMT+8
第二种:局部配置
使用该注解实现时间格式化
@JsonFormat(pattern = "yyyy:MM:dd HH:mm:ss",timezone="GMT+8")

通过application.yml文件进行全局配置,配置信息如下。
spring:
jackson:
date-format: yyyy-MM-dd hh:mm:ss
time-zone: GMT+8
第二种:局部配置
使用该注解实现时间格式化
@JsonFormat(pattern = "yyyy:MM:dd HH:mm:ss",timezone="GMT+8")