这里转成yyyy-MM-dd HH:mm:ss为例:
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Timestamp time;
这样在Restful中就可以了。但如果是在websocket中,要传String,就要用另外一种方式了:
JSONObject.toJSONStringWithDateFormat(myObject, "yyyy-MM-dd HH:mm:ss")
这里转成yyyy-MM-dd HH:mm:ss为例:
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Timestamp time;
这样在Restful中就可以了。但如果是在websocket中,要传String,就要用另外一种方式了:
JSONObject.toJSONStringWithDateFormat(myObject, "yyyy-MM-dd HH:mm:ss")