jquery $.ajax()
sends dates from browser as json in ISO format: yy-mm-dd
(or I can use yyyy-mm-dd
if this is better) in POST
body.
ASP.NET MVC4 Web API controller contains DateTime
property for this.
How to get date value in any server thread culture settings?
I tried
public class TestController : ApiController {
public class PlaaniSisend
{
public DateTime date { get; set; }
}
[HttpPost]
public HttpResponseMessage Post([FromBody] PlaaniSisend vali)
{
Console.Write(vali.date );
}
}
If server thread culture date format is different than ISO, vali.date value is wrong. How to fix this so that ISO date format is uset for parse in any server culture settings ?