如何获得总分钟数并增加总时间? [英] HOW TO GET TOTAL OF MONEY OF MINUTES AND ADD IT HOURS TOTAL?
本文介绍了如何获得总分钟数并增加总时间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在手术中需要帮助
我总计'小时和分钟后
i(moneytotal = Price * Hours)以便获得总金额,
代码:
i need help in an operation
after i ve got totals of' hour and minutes
i did ( moneytotal = Price * Hours) so as to get total of money,
code:
DGTotalMoney.DigitText = (double.Parse(DGHours.DigitText) * (double.Parse(CBlistPrice.Text))).ToString();
但我需要计算分钟数并将其添加到小时
but i need to count minutes too and add it to hours
推荐答案
@Atif尝试以下功能将时间转换为100格式。
@Atif Try below function to convert time to 100 format.
protected double ConvertTo100(string strTemp)
{
strTemp = strTemp.Replace(':', '.');
double dblTemp;
dblTemp = Convert.ToDouble(strTemp);
double dblHH = Math.Floor(dblTemp);
double dblMM = Math.Round(dblTemp - Math.Floor(dblTemp), 2) * 60 / 100;
double dboReturn;
dboReturn = dblHH + dblMM;
return dboReturn;
}
比你可以使用这个函数...
than you can use this funcation like..
DGTotalMoney.DigitText = Convert.ToString(ConvertTo100("Your time here in HH:MM format") * (double.Parse("Your Price Here")));
DGTotalMoney.DigitText = (double.Parse(DGHours.DigitText + (DGMinutes.DigitText / 60)) * (double.Parse(CBlistPrice.Text))).ToString();
希望这是你想要的。
Hope this is what you wanted.
这篇关于如何获得总分钟数并增加总时间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文