Convert Milliseconds to DateTime.

 Console.WriteLine("Current DateTime : " + DateTime.Now);

DateTime baseDate = new DateTime(1970, 1, 1);
TimeSpan diff = DateTime.Now - baseDate;

Console.WriteLine("Current DateTime in MS : " + diff.TotalMilliseconds);

Console.Write("Milliseconds to DateTime :" + (new DateTime(1970, 1, 1)).AddMilliseconds(diff.TotalMilliseconds));
Advertisements