springboot日期入参出参格式化注解:@DateTimeFormat 和 @JsonFormat (转)

转自:https://blog.csdn.net/zhou520yue520/article/details/81348926

public class DateVo {
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
    private Date date;
 
    public void setDate(Date date){
        this.date = date;
    }
    public Date getDate(){
        return date;
    }
}
原文地址:https://www.cnblogs.com/wangbin2188/p/15009783.html