Handle negative time spans

前端 未结 9 615
不知归路
不知归路 2020-12-30 18:50

In my output of a grid, I calculate a TimeSpan and take its TotalHours. e.g.

(Eval(\"WorkedHours\") - Eval(\"BadgedHours\")).TotalH         


        
9条回答
  •  余生分开走
    2020-12-30 19:24

    Hi i worked this into a bit of code i have been writing, hope it helps

    (results) is an int variable

    (TimeSpan.FromMinutes(result)) < TimeSpan.Zero ? "-" + TimeSpan.FromMinutes(result).ToString(@"hh\:mm") : "" + TimeSpan.FromMinutes(result).ToString(@"hh\:mm");

提交回复
热议问题