hi friends plz tell me how to add time which is in HH:MM:SS (in 24 hr format). i have a array of time stored. need to add those times and calculate total time...

Your question is ambiguous. Please provide an example with input and the desired result.

Your question is ambiguous. Please provide an example with input and the desired result.

timedif[0] = "01:11:00";
timedif[1] = "00:10:00";
timedif[2] = "01:56:00";

sum = timedif[0] + timedif[1] + timedif[2]

sum should be 03:17:00


now the above array has time in HH:MM:SS format want to convert this to timespan or anything and add this times to sum variable

Console.WriteLine(
    TimeSpan.Parse("01:11:00") +
    TimeSpan.Parse("00:10:00") +
    TimeSpan.Parse("01:56:00"));

What's the problem? ;)

Console.WriteLine(
    TimeSpan.Parse("01:11:00") +
    TimeSpan.Parse("00:10:00") +
    TimeSpan.Parse("01:56:00"));

What's the problem? ;)

Tx a lot this helped.


tx again;)

...pretty-much the same thing:

using System;
using System.Collections.Generic;

namespace DW_412697_CS_CON
{
   class Program
   {
      static void Main(string[] args)
      {
         TimeSpan ts = new TimeSpan();
         new List<string>{"01:11:00", "00:10:00", "01:56:00"}
            .ForEach(s => ts += TimeSpan.Parse(s));

         Console.WriteLine(ts.ToString());
      }
   }
}