How can a Timespan-Day last only for 8 Hours?

前端 未结 3 1567
我在风中等你
我在风中等你 2021-01-03 08:07

I have saved a duration in minutes and want to have an output \"1 day 5 hours 30 minutes\". Currently i add the minutes to a Timespan and do something like this:

<         


        
3条回答
  •  我在风中等你
    2021-01-03 08:52

    Can you simply use:

    (int)(ts.TotalHours / 8)
    

    instead of ts.Days? Then use

    (((int)ts.TotalHours) % 8)
    

    instead of ts.Hours.

提交回复
热议问题