When working with web application and dealing with JSON formatted data, we may come across date types that are represented as /Date(1347490800000)/. The value between the parenthesis i.e. 1347490800000 indicates the number of milliseconds elapsed since 1st Jan 1970.
var myJSONDate = "/Date(1347490800000)/"; //For demonstration purpose but in realtime we will get from Ajax call returning data in JSON format
var value = new Date(parseInt(myJSONDate.replace(/\/Date\((.*?)\)\//gi, "$1")));
Similarly, we will can construct the DateTime object in .NET from JSON date as follows:
var jsonDate = "/Date(1347490800000)/";
jsonDate = System.Text.RegularExpressions.Regex.Replace(jsonDate, @"/Date\((.*?)\)\/", "$1");
var date = new DateTime(1970, 1, 1, 0, 0, 0, 0).AddMilliseconds(long.Parse(jsonDate));
Hope this helps…