如何划分总时间以小时为单位分钟 [英] how to divide total time in hours & minutes

查看:216
本文介绍了如何划分总时间以小时为单位分钟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

伙计们,



我必须计算总时间为小时和分钟,



如何计算我是否有时间小数。

15.35 + 15.35



如何得到这个结果:31.10小时



我怎么能把它分成hh:mm



任何人都可以帮我写这个公式。



谢谢

Hi guys,

I have to calculate total time into hours & minutes,

how to calculate if i have time in decimals.
15.35 + 15.35

how to get this result: 31.10 hrs

how can i divide this into hh:mm

can anyone please help me to write the formula for this.

Thanks

推荐答案

我想你想做的是:
TimeSpan ts1 = TimeSpan.FromHours (12.34);
TimeSpan ts2 = TimeSpan.FromHours (56.78);
TimeSpan sum = ts1 + ts2;
Console.WriteLine ("Total timespan = {0}hrs which is {1}hrs and {2}mins",
                   sum.TotalHours, sum.Hours, sum.Minutes);

/ ravi


这篇关于如何划分总时间以小时为单位分钟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆