DateTime oldDate = new DateTime(2002,7,15);<br /> DateTime newDate = DateTime.Now;<br /> // Difference in days, hours, and minutes.<br /> TimeSpan ts = newDate - oldDate;<br /> // Difference in days.<br /> int differenceInDays = ts.Days;<br /> Console.WriteLine("Difference in days: {0} ", differenceInDays);
DateTime dt1 = new DateTime(2009, 12, 1); DateTime dt2 = new DateTime(2010, 11, 5); int nodays = dt2.Subtract(dt1).Days;
nodays
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)