Date Formats API + C #

-2

I developed the system in layers, and I have 2 layers, where layer number 1 is my API and number 2 is where I store my classes.

In one of the classes I have a field of type DateTime .

I created a method in my API that receives an object of this class.

I am sending PostMan a request with the value of the date attribute of this object equal to 01/07/2018

But when the request hits the API, the same attribute arrives with 07/01/2018

As shown below

POSTMAN

API

[HttpPost]
[Route("Salvar")]
public HttpResponseMessage Post(IntencaoDeCompraViewModel obj)
{
    ApiResult result = _intencaoDeCompraJsonAppServices.AddLead(obj);
    if (result.Status == MessageType.Error)
        return Request.CreateResponse(HttpStatusCode.BadRequest, result);

    return Request.CreateResponse(HttpStatusCode.OK, result);
}
    
asked by anonymous 25.10.2018 / 17:10

1 answer

-1

string dataDate = InitialDateTime.Value.ToString ("dd-MM-yyyy");             Convert.ToDateTime (desiredDate);

    
25.10.2018 / 21:51