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;
    }
}

 

posted @ 2021-07-14 10:45  Mars.wang  阅读(1164)  评论(0编辑  收藏  举报