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主要是前后到后台的时间格式的转换

原文地址:https://www.cnblogs.com/lijianda/p/12871063.html