使用的Spring+SpringMvc+Mybatis。

想把一个时间对象用ajax的方式传入到前端,但是获取到的值是时间戳。

不想写太多复杂的转换,可以使用注解直接解决。

需要导入fastjson的包。

直接在entity类中的时间对象上面写上注解@JSONField(format = "yyyy-MM-dd HH:mm:ss")即可。

    @JSONField(format = "yyyy-MM-dd")
    private Date creationTime;

  

相关文章:

  • 2021-12-11
  • 2021-11-18
  • 2021-08-12
  • 2022-12-23
  • 2021-10-16
  • 2021-08-22
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-05-23
  • 2021-08-13
  • 2022-12-23
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案