I am using a web service which returns me JSON data.
one of the value in that JSON data is datetime.
1421788745000 - This is the value returned for that datetime field.
When I tried to convert that value into DateTime (using below code), it returns me 01/02/0001 3:29:38 PM.
foreach(dynamic jResult in jsonResult["twtDetails"])
{
DateTime date = new DateTime(long.Parse("1421788745000"));
DateTime dt = new DateTime(createdAtTime);
}
But when I tried to parse the same value using following javascrit code (using this site - http://jsfiddle.net/ ), I got a valid date : Tuesday 20th Jan 2015
alert(new Date(1421788745000).toUTCString());
Can somebody tell me what is the correct C# code for this ?