The JSON specification does not specify a format for exchanging dates which is why there are so many different ways to do it. Microsoft .NET Web APIs returns JSON dates in standardized format by default, but the older versions of .Net framework may serialize the C# datetime object into a strange string format like /Date(1530144000000+0530)/ or /Date(1530144000000)/ . The number within the JSON Date string actually denotes the number on milliseconds that have passed since 01-01-1970 .
Then let's convert it to js format:
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 .