1 DateTime oldDate = new DateTime(2002,7,15); 2 DateTime newDate = DateTime.Now; 3 // Difference in days, hours, and minutes. 4 TimeSpan ts = newDate - oldDate; 5 // Difference in days. 6 int differenceInDays = ts.Days;
2021-10-23 03:07:40
1 DateTime oldDate = new DateTime(2002,7,15); 2 DateTime newDate = DateTime.Now; 3 // Difference in days, hours, and minutes. 4 TimeSpan ts = newDate - oldDate; 5 // Difference in days. 6 int differenceInDays = ts.Days;