use the Subtract() method to subtract a TimeSpan from a DateTime

image_pdfimage_print
   
 
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 myDateTime7 = myDateTime6.Subtract(myTimeSpan);
        Console.WriteLine("myDateTime6.Subtract(myTimeSpan) = " + myDateTime7);


    }
}