使用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