Here is what I am getting as data:
jsonp1290537545248( [{“Active”:true,”EndDate”:”\/Date(-62135578800000-0500)\/”,”StartDate”:”\/Date(1280635200000-0400)\/”}] );
$.getJSON(url, {},
function (data) {
alert(data[0].EndDate);
alert(Date(data[0].StartDate));
//alert(data[0].StartDate.getDate());// + "/" + (data[0].StartDate.getMonth() + 1) + "/" + data[0].StartDate.getFullYear()); // alerts: "15/10/2008"
//var date = eval(jsonDate.replace(/\/Date\((\d+)\)\//gi, "new Date($1)"));
alert('dd ' + new Date(parseInt(data.substr(6))));
});
How do I get in the MM/DD/YYYY format?
I would use a similar regex to what Zain posted, but not use
eval()like this (demo):And what is that end date? It doesn’t seem to be a difference and if you use that number as a new date you end up with “Sun Dec 31 0000 22:59:59 GMT-0600 (Central Standard Time)”… so I wasn’t sure what to do with that value.