use the overloaded addition operator (+) to add a TimeSpan to a DateTime
using System;
class MainClass {
public static void Main() {
TimeSpan myTimeSpan = new TimeSpan(1, 2, 4, 10);
DateTime myDateTime6 = DateTime.Parse("1/13/2004 23:10:30");
DateTime myDateTime8 = myDateTime6 + myTimeSpan;
Console.WriteLine("myDateTime6 + myTimeSpan = " + myDateTime8);
}
}
Related examples in the same category