How to calculate hours between days?

@KevinDS
(endDate-initDate) will give you the TimeSpan between your two date times. The timespan is 2 days and 2 hours, so when you use the Hours method you get 2. If you instead use TotalHours it will count all hours in the TimeSpan.

image

image

1 Like