Seeking advice on date formatting.
I am currently developing an AngularJS application that retrieves data from an ASP.NET Web API. Within a table (Model), there is a date field (ThisDate) with the following format:
2015-03-14 12:39:32.470
When I pass this as a response JSON string from ASP.NET -
string json = "{\"CreatedAt\": \"" + Model.ThisDate + "\"}";
response.Content = new StringContent(json, Encoding.UTF8, "application/json")
...the output in my AngularJS app differs to:
14-03-2015 12:39:32
And when I send it as a JSON serialized object from ASP.NET -
JsonConvert.SerializeObject(Model)
...the output in my AngularJS app changes to:
2015-03-14T12:39:32.470
What could be causing this discrepancy? I aim for consistency to ensure correct sorting. Any suggestions on how to accomplish this?
Your insights are greatly appreciated.