Parse and send Microsoft JSON Date using Javascript

use the following code

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

To pass the date back to the ASP.NET server to deserialize, note that JSON.stringify will escape the slashes in the date values causing parse error in the server. To correct this, use the code below
(shttp://stackoverflow.com/questions/11852432/using-net-javascriptserializer-deserialize-with-datetime-from-client)

function customJSONstringify(obj) {
    return JSON.stringify(obj).replace(//Date/g, "/Date").replace(/)//g, ")/")
}

Leave a Reply

Your email address will not be published. Required fields are marked *