Use the Negate() method to add two TimeSpan instances : TimeSpan : Date Time C# Examples


C# Examples » Date Time » TimeSpan »

 

Use the Negate() method to add two TimeSpan instances









    
using  System;

class  MainClas
{
    public  static  void  Main()
    {
        TimeSpan  myTimeSpan13  =  new  TimeSpan(1,  10,  13);
        TimeSpan  myTimeSpan14  =  new  TimeSpan(2,  6,  10);
        TimeSpan  myTimeSpan15  =  myTimeSpan13.Subtract(myTimeSpan14);
        
        
        Console.WriteLine("myTimeSpan15.Negate()  =  "  +  myTimeSpan15.Negate());
        Console.WriteLine("myTimeSpan14.Negate()  =  "  +  myTimeSpan14.Negate());


    }
}
    
   
  
   



Output

myTimeSpan15.Negate() = 00:55:57
myTimeSpan14.Negate() = -02:06:10


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» TimeSpan