C# TimeSpan TotalDays
Description
TimeSpan TotalDays
gets the value of the current TimeSpan
structure expressed in whole and fractional days.
Syntax
TimeSpan.TotalDays
has the following syntax.
public double TotalDays { get; }
Example
The following example instantiates a TimeSpan object and displays the value of its TotalDays property.
using System;// w ww .j a va2 s. c om
public class Example
{
public static void Main()
{
// Define an interval of 3 days, 16+ hours.
TimeSpan interval = new TimeSpan(3, 16, 42, 45, 750);
Console.WriteLine("Value of TimeSpan: {0}", interval);
Console.WriteLine("{0:N5} days, as follows:", interval.TotalDays);
}
}
The code above generates the following result.