How to format the json date format using spring boot

前端 未结 1 562
南笙
南笙 2021-02-19 07:48

I am working on spring boot and gradle for creating a rest service. Now I need to format the json date in the form of \"yyyy-MM-dd\", i.e, the format should be dateOfBirth: \"16

1条回答
  •  一向
    一向 (楼主)
    2021-02-19 08:13

    With Spring Boot, you should be able to set the default way that Jackson formats dates by setting the following property in your application.yml/application.properties:

    spring.jackson.date-format= # Date format string (e.g. yyyy-MM-dd HH:mm:ss), or a fully-qualified date format class name (e.g. com.fasterxml.jackson.databind.util.ISO8601DateFormat)
    

    0 讨论(0)
提交回复
热议问题