SpringBoot接收对象中包含时间参数,格式化接收时间

SpringBoot接收对象中包含时间参数,前端传过来的时间数据为'2019-12-19 08:08:08',SpringBoot不能自己转化时间为Date,会报错。

解决办法:

使用@JsonFormat注解

@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")

 
posted @ 2019-12-19 22:07  尘世间迷茫的小书童  阅读(2554)  评论(0编辑  收藏  举报