3

enter image description here

I am passing a date-time 31-05-2019 23:59:59 in query string using swagger UI but getting an exception for invalid date-time. Please see attached screenshot.

1 Answer 1

6

The DateTime must conform to ISO-8601 format which is yyyy-MM-dd'T'HH:mm:ssZ and therefore you should change the date-time to 2019-05-31T23:59:59Z before you pass it to the query. Note that Z stands for Zulu and specifies UTC+00:00. If your date-time value has some other zone-offset, specify that in the format, ("+" / "-") time-hour ":" time-minute e.g. 2019-05-31T23:59:59+05:30 which specifies a date-time with a timezone offset of 5 hours and 30 minutes (India Standard Time).

Given below is an excerpt from Swagger Data Types:

String Formats

An optional format modifier serves as a hint at the contents and format of the string. 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-21T17:32:28Z
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.