Add or Sum of hours like 13:30+00:00:20=13:30:20 but how?

myDateTimeVariable.Add(new TimeSpan(2,2,2));

Adding two datetimes from strings:

var result = DateTime.Parse(firstDate) + DateTime.Parse(secondDate);

Adding a string time to a datetime:

var result = existingDateTime.Add(TimeSpan.Parse(stringTime);

Adding time as in your example:

var result = TimeSpan.Parse("12:30:22") + TimeSpan.Parse("11:20:22");

Finally, your example as dates (not tested!):

var result = DateTime.Parse("12:30:22") + DateTime.Parse("11:20:22");

Note that this is sloppy coding, but you get the idea. You need to verify somehow that the string is actually parseable.


If you choose to use the TimeSpan, be aware about the Days part:

TimeSpan t1 = TimeSpan.Parse("23:30");
TimeSpan t2 = TimeSpan.Parse("00:40:00");
TimeSpan t3 = t1.Add(t2);
Console.WriteLine(t3); // 1.00:10:00

With DateTime:

DateTime d1 = DateTime.Parse("23:30");
DateTime d2 = DateTime.Parse("00:40:00");
DateTime d3 = d1.Add(d2.TimeOfDay); 
Console.WriteLine(d3.TimeOfDay); // 00:10:00