How to pass a JSON date value via ASP.NET MVC using JSON.NET?

asp.net-mvc, datetime, javascript, json, json.net

Solution

This was found in another post on Stack Overflow:

var date = new Date(parseInt(jsonDate.substr(6))); 

The substr function takes out the "/Date(" part, and the parseInt function gets the integer and ignores the ")/" at the end. The resulting number is passed into the Date constructor.

Problem

Possible Duplicate: Format a Microsoft JSON date? The ASP.NET function `Json()` formats and returns a date as ``` {"d":"\/Date(1240718400000)\/"} ``` which has to be dealt with on the client side which is problematic. What are your suggestions for approaches to sending date values back and forth?

Original source

Related problems