Convert Datetime Received in JSON to a .Net DateTime
Some times when you receive a date time from a JSON string it is in UNIX Epoch format. The date time will come over as a number which is the number of milliseconds since Jan 1, 1970. To convert it to a .net DateTime create a DateTime for Jan 1, 1970 and add the milliseconds to get the actual time sent over.
var offset = 1380234600000;
// First make a System.DateTime equivalent to the UNIX Epoch.
System.DateTime dateTime = new System.DateTime(1970, 1, 1, 0, 0, 0, 0);
// Add the number of seconds in UNIX timestamp to be converted.
dateTime = dateTime.AddMilliseconds(offset).ToLocalTime() ;
See Also
Another important place to find a huge amount of Windows Phone related articles is the TechNet Wiki itself. The best entry point is Windows Phone Resources on the TechNet Wiki.