prasanna kumar

prasanna kumar

  • NA
  • 12
  • 26.7k

To find Time Difference using C#

Jul 11 2007 4:25 PM
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)