使用Jackson的@JsonFormat注解时出现少一天mysql
好比数据库存的日期是2015-01-05,转成json则变成了2015-01-04sql
解决办法:数据库
@JsonFormat(pattern="yyyy-MM-dd")
public Date getRegistDate() {
return this.registDate;
}json
改为this
@JsonFormat(pattern="yyyy-MM-dd",timezone="GMT+8")
public Date getRegistDate() {
return this.registDate;
}.net
加上时区便可,中国是东八区orm