Updated on Kisan Patel
Problem:
When working with ASP.NET Web API or any other web service, you have to work with JSON data that is returned for Date data types and you have getting a string back that looks like this:
\/Date(1442255400000)\/
Solution:
var date = new Date(parseInt("\/Date(1442255400000)\/".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.
Source:
http://stackoverflow.com/questions/206384/format-a-microsoft-json-date