c# date difference in days code example
Example 1: c# calculate difference between two dates in days
(EndDate - StartDate).TotalDays //double
(EndDate.Date - StartDate.Date).Days //int
Example 2: fdifference between two date in hours c#
double dif = (greaterDate - smallerDate).TotalHours;