4
Answers

To find Time Difference using C#

prasanna kumar

prasanna kumar

17y
2.2k
1
Hello,
I was looking for C# objects and properties to find the time difference between two dates in hh:mm format.

date1 = " 12/21/2007 10:20 pm "
date2 = " 12/22/2007 10:35 pm"

My result should be  time difference between date2 and date1 which would be in the format of  24:15(hh:mm)

I used Timespan and DateTime classes but they return either the total hours or total minutes. But, not the time difference in hh:mm format.
Any help will be appreciated.
Thanks,
Prasanna.
Answers (4)