前端传入一个String的时间字符串如:2019-07-18 23:59:59

后端实体类要在头顶加注解:

@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")

记springboot 实体类String转Date类型的坑

 

 记得引入

<dependency>
    <groupId>joda-time</groupId>
    <artifactId>joda-time</artifactId>
    <version>2.3</version>
</dependency>

 

 

jsonformat是将date转换为String,而DatetimeFormat是将string转换为date

相关文章:

  • 2021-09-04
  • 2021-07-07
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-09-20
猜你喜欢
  • 2022-01-15
  • 2022-12-23
  • 2022-12-23
  • 2021-08-11
  • 2021-07-29
  • 2021-09-02
相关资源
相似解决方案