Need help with addition of timestamps

  • Thread starter Thread starter Lars Vonderschmitt
  • Start date Start date
L

Lars Vonderschmitt

Hi,

I am trying to do some calculation with times. I got a list of times
like "12:23" (mm:ss) and I want to take the sum of all my times and
output this to a textbox.
But I have no clue how to do this. Could anybody point me into the right
direction?

Thanks!
Lars
 
Use time span for such tasks. Here you are a small sample for it:

TimeSpan t = TimeSpan.Parse("00:01:10"); // HH:mm:ss
TimeSpan t2 = TimeSpan.Parse("00:01:20");

string result = t.Add(t2).ToString();
 
Sergey said:
Use time span for such tasks. Here you are a small sample for it:

TimeSpan t = TimeSpan.Parse("00:01:10"); // HH:mm:ss
TimeSpan t2 = TimeSpan.Parse("00:01:20");

string result = t.Add(t2).ToString();

Thanks, that is exactly what I was looking for.

Lars
 
Back
Top