C# TimeSpan TotalMilliseconds

Description

TimeSpan TotalMilliseconds gets the value of the current TimeSpan structure expressed in whole and fractional milliseconds.

Syntax

TimeSpan.TotalMilliseconds has the following syntax.


public double TotalMilliseconds { get; }

Example

The following example instantiates a TimeSpan object and displays the value of its TotalMilliseconds property.


using System;//from   w w  w  .  j a  v a 2  s  .c  om

public class Example
{
   public static void Main()
   {
      // Define an interval of 1 day, 15+ hours.
      TimeSpan interval = new TimeSpan(1, 15, 42, 45, 750); 
      Console.WriteLine("Value of TimeSpan: {0}", interval);

      Console.WriteLine("There are {0:N5} milliseconds, as follows:", interval.TotalMilliseconds);

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version