Subtract one TimeSpan from another TimeSpan in CSharp

Description

The following code shows how to subtract one TimeSpan from another TimeSpan.

Example


using System;/*from  w w  w  .j  av a  2  s . com*/

class TimeSpanAddSubDemo
{
    static void Main( )
    {
         Console.WriteLine(new TimeSpan( 1, 20, 0 ).Subtract(new TimeSpan( 0, 45, 10 )));
    } 
}

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