json.net - Convert C# DateTime to JavaScript date automatically using Json Serialization in Dot Net Core 2 WebApi -


is possible convert c# datetime fields javascript dates automatically when returning results dot net core 2.0 webapi controller call?

at moment, when datetime value returned server side call, returns in format: "2013-02-01t00:00:00"

i have thought possible set jsonserializer options return value converted javascript date without needing parse via secondary parser such moment.

anyone know how this?

you should add following line startup.cs class in configureservice function:

services             .addmvc()             .addjsonoptions(x => x.serializersettings.dateformathandling = newtonsoft.json.dateformathandling.microsoftdateformat); 

then can date in json format while serialize data.


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -