-
方法1: 使用
@JsonFormat
注解(放在date属性或者其get方法上都可以)@JsonFormat(pattern = "yyyy-MM-dd HH-mm-ss") private Date createTime;
-
方法2: 在配置文件中配置
spring.jackson.date-format
spring: jackson: date-format: yyyy-MM-dd HH:mm:ss
返回日期字段一行代码进行格式化处理
猜你喜欢
转载自blog.csdn.net/qq_26496077/article/details/114638726
今日推荐
周排行