Convert TimeSpan string in CSharp

Description

The following code shows how to convert TimeSpan string.

Example


using System;//from   w w  w .ja va 2 s.  c o  m

public class ToString
{
    public static void Main()
   {
      TimeSpan span  = TimeSpan.Zero;
      Console.WriteLine(span);

      // Initialize a time span to 14 days.
      span = new TimeSpan(-14, 0, 0, 0, 0);
      Console.WriteLine(span);

   }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Data Types »




C# Data Types
Bool
Byte
Char
Decimal
Double
Float
Integer
Long
Short
String
C# Array
Array Example
Byte Array
C# Standard Data Type Format
BigInteger
Complex
Currency
DateTime
DateTimeOffset
DateTime Format Parse Convert
TimeSpan
TimeZone
Enum
Null
tuple
var