TimeSpan + TimeSpan : TimeSpan « System « C# / C Sharp by API






TimeSpan + TimeSpan

  
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);
    
    }
}

   
    
  








Related examples in the same category

1.new TimeSpan(days, hours, minutes, seconds)
2.new TimeSpan(days, hours, minutes, seconds, milliseconds
3.new TimeSpan(ticks)
4.TimeSpan.Add(TimeSpan ts)
5.TimeSpan.Duration()
6.TimeSpan.FromDays
7.TimeSpan.Milliseconds
8.TimeSpan.Negate()
9.TimeSpan.Parse
10.TimeSpan.Subtract(TimeSpan ts)
11.TimeSpan.TicksPerDay
12.TimeSpan.TotalDays