在属性中加上@JsonFormat注解即可,后面时区为东八区时间
例:
@Column(name = “update_date”)
@JsonFormat(pattern =“yyyy-MM-dd HH:mm:ss”, timezone = “GMT+08:00”)
private Date updateDate;
java关于数据查询返回时间格式为时间戳问题
最新推荐文章于 2025-03-02 14:02:31 发布
博客介绍在Java属性中使用@JsonFormat注解设置时间格式的方法,通过示例展示在属性中添加该注解,并将时区设为东八区,可解决数据查询返回时间戳及时间不准等问题。
5120

被折叠的 条评论
为什么被折叠?



