java-时间格式转换

@JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")

   pattern:是你需要转换的时间日期的格式

   timezone:是时间设置为东八区,避免时间在转换中有误差

@DateTimeFormat(pattern = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
private Date symstarttime;

总结: 

  注解@JsonFormat主要是后台到前台的时间格式的转换

  注解@DataFormAT主要是前后到后台的时间格式的转换

posted on 2020-05-11 18:43  LJD泊水  阅读(2065)  评论(0)    收藏  举报