Parsing date object in Postman to be converted to C# DateTime

36,018

Solution 1

I am using the following Json Snippet to test our API. If you want only Date, you can use Year-Month-Day format.

{       
    "messageId": "{{$guid}}",
    "identityToken": "{{identityToken}}",
    "UserLogin": "test_login",
    "StartDate" : "2017-08-01",
    "EndDate" : "2017-08-09"
}

Solution 2

As @adaam pointed to the doc in the comment, the correct format is 2016-06-03T10:34. We use this to test our API endpoints and it works as expected.

Share:
36,018
strizzwald
Author by

strizzwald

Updated on August 15, 2020

Comments

  • strizzwald
    strizzwald over 3 years

    I would like to know how I can parse a date in my JSON object that can be converted to DateTime in my WebApi controller.

    myObject: {
                  "key":"value",
                   ...
                  "DateOfBirth": "" // <-- What should I parse my date as here?
              }
    

    FYI, I am using Postman to test my RESTful endpoints.