duration between 2 dates c# 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;