Mega Code Archive

 
Categories / C# / Date Time
 

Gets the value of TimeSpan in whole and fractional seconds

using System; public class Example {    public static void Main()    {       TimeSpan interval = new TimeSpan(1, 1, 42, 45, 750);        Console.WriteLine("Value of TimeSpan: {0}", interval);       Console.WriteLine("{0:N5} seconds, as follows:", interval.TotalSeconds);    } }