When you are using the controller JSON method in ASP.NET MVC or scriptable WCF services you sometimes have to serialize a .NET DateTime property. The DataContractJsonSerializer will serialize it into the following format:
This format indicate to the client side parsers that the data fragment that was sent is a date representation.
There are a few methods:
- “Brutal Force”: Extract the number using regular expression or substring functions and pass it to the Date object which get the time in milliseconds in its constructor:
- The Eval Way: on the client side use the eval function to evaluate and create the Date object:
Where the dateFromTheServer is in the format which was presented at the top of the post.
There are probably other ways which can help you. What is your way?