In my output of a grid, I calculate a TimeSpan
and take its TotalHours
. e.g.
(Eval(\"WorkedHours\") - Eval(\"BadgedHours\")).TotalH
its working .try this
mytimespam.Negate();
I checked to every where.But i didnt get a correct answer that why i used this way to finish
TimeSpan diff = actualout.Subtract(actualin);
string a =(diff.ToString()).ToString();
if(a.Contains("-"))
{
diff = new TimeSpan(0,0,0,0);
}
There is a Negate method in the TimeSpan class.
Link to the MSDN documentation: TimeSpan.Negate Method()