Swagger custom date format For example, 2023-02-08T18:04:28Z matches this format. 6. Frontend requirements might dictate a different date format for user clarity. An optional format modifier serves as a hint at the contents and format of the string. The formats for an ISO8601 date are as follows: Year: YYYY (2018) Year and month: YYYY-MM (2018-04) Complete date: YYYY-MM-DD (2018-04-25) Mar 8, 2025 · The date-time format refers to the date-time notation defined by RFC 3339, section 5. Implement a Swagger schema filter to customize the date format output. Jun 7, 2018 · The pattern for this date and time format is YYYY-MM-DDThh:mm:ss. . Let’s now add an endDate property of date-time format to our Event: endDate: type: string format: date-time. OpenAPI defines the following built-in string formats: date – full-date notation as defined by RFC 3339, section 5. 6, for example, 2017-07-21; date-time – the date-time notation as defined by RFC 3339, section 5. 6, for example, 2017-07 Mar 20, 2018 · BookingNoteRequest: type: object properties: note: type: string postedDate: type: string format: date example: '2022-07-01' postedTime: type: string format: date-time example: '2017-07-21T17:32:28Z' If the date or date-time format does not follow the standard as defined by RFC 3339, then the format field should be removed and the pattern field See full list on baeldung. It is recommended to use the ISO-8601 format for representing the date and time in your RESTful web APIs. Once more, we don’t need to modify the configuration of any of the plugins. String Formats. sTZD. com API implementations often use ISO 8601 date format by default. Set the schema properties to interpret dates based on your preferred format. Aug 24, 2022 · In order to allow the API to accept a date in the expected format “2022-08-24” and for Swagger to display the examples correctly it’s necessary to first add a converter. Solutions.