Mega Code Archive

 
Categories / C# / Date Time
 

Gets the value of TimeSpan in whole and fractional milliseconds

using System; public class Example {    public static void Main()    {       TimeSpan interval = new TimeSpan(1, 5, 2, 45, 750);        Console.WriteLine("Value of TimeSpan: {0}", interval);       Console.WriteLine("There are {0:N5} milliseconds, as follows:", interval.TotalMilliseconds);    } }