打断点发现返回给前端的日期是没有错的;那么:
解决方式:
原:
import org.springframework.format.annotation.DateTimeFormat;
import com.fasterxml.jackson.annotation.JsonFormat;
// 实际开始时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date actualEndTime;
现在:
// 实际开始时间
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date actualEndTime;
在对象中日期属性前加上timezone = “GMT+8”;
如果返回给前端的是一整串数字,添加这两个注解即可;



