possible duplicate:
Convert TimeSpan.TotalMilliseconds to datetime and format it as hour:minute
[edited]
also
Sent = u.DateSent,
Reply = u.DateReply,
ResponseTime = Reply - Sent
});
which give me the time different between the two datatime is 10 days, but i want to calculate the hour and minute during the time interval,(for example if datesent is 09/02/2011 2:00 pm , and dateReply is 09/02/2011 4:30 pm , then the response time should be 2:30 ) still havent figure this out, anyone has idea, either format it in linq or do it over the view page?
You can change the ResponseTime type to TimeSpan and than do the following:
I just put the Console.WriteLine so you could see how I’m getting the Hour and Minute just like the way you want. From milliseconds, you could create a new TimeSpan passing the milliseconds to the constructor, and again you could get the Hour/Minute in this newly created TimeSpan.
I just put the hardcoded dates so you could actually see the usage based on your example.
I hope it helps.