javascriptserializer date format issue

Subhasis picture Subhasis · Oct 28, 2010 · Viewed 8.4k times · Source

I am serializing a complex object with lot of properties of other Types and Lists to JSON form but the issue is with DateTime properties. I get the epoch time with JavascriptSerializer (rather than mm/dd/YYYY).

Is there any way I can get the datetime in mm/dd/YYYY : HH.MM.SS form without modifying the class defination of the object i am serialzing.

Answer

Darin Dimitrov picture Darin Dimitrov · Oct 28, 2010

This cannot be achieved using JavaScriptSerializer and without modifying the underlying class. This could be achieved with Json.Net.