TimeSpan calculation : TimeSpan : Date Time C# Examples


C# Examples » Date Time » TimeSpan »

 

TimeSpan calculation









    
using  System;

class  MainClass
{
        public  static  void  Main(string[]  args)
        {
                TimeSpan  timespan1  =  new  TimeSpan(2,  12,  0,  0);

                //  Create  a  TimeSpan  representing  4.5  days.
                TimeSpan  timespan2  =  new  TimeSpan(4,  12,  0,  0);

                //  Create  a  TimeSpan  representing  1  week.
                TimeSpan  oneWeek  =  timespan1  +  timespan2;
                
                Console.WriteLine("oneWeek      :  {0}",  oneWeek);
        
        }
}
    
   
  
   



Output

oneWeek   : 7.00:00:00


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo Date Time
» TimeSpan