Abhilash J A

Abhilash J A

  • 530
  • 2.4k
  • 598k

How to calculate difference between 2 TimeSpan ?

Sep 20 2016 2:37 AM
Hello Everyone,
In my MVC4 project, I want to calculate the difference of employee's checkIn and checkOut time. But the 'workedTime' shows munus sign. How can I remove when page showing in browser?
 
TimeSpan d1 = new TimeSpan(00,00,00);
 
d1 ="08:14:55";
 
TimeSpan day = new TimeSpan(08, 30, 00);
 
TimeSpan workedTime = new TimeSpan(00, 00, 00);
 
workedTime = d1.Subtract(day);

Answers (9)