版权声明:_____________________不积跬步,无以至千里;不积小流,无以成江海。(转载若侵权,联系删除) https://blog.csdn.net/icecoola_/article/details/78057326
@JsonFormat 默认是标准时区的时间,多出现少8小时的情况
使用时,按需求加上时区 北京时间 东八区 timezone=”GMT+8”
作用:后台的时间 格式化 发送到前台
@DateTimeFormat 接受前台的时间格式 传到后台的格式
import java.util.Date; import org.springframework.format.annotation.DateTimeFormat; import com.fasterxml.jackson.annotation.JsonFormat; public class CusDevPlan { private Integer id; private String planItem; @JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8") @DateTimeFormat(pattern="yyyy-MM-dd") private Date planDate; ... } 1234567891011121314
<link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-a47e74522c.css" rel="stylesheet"> </div> 12