我需要在vb6中编写代码
examble:
13“天” - 10%= 11“天”,16“小时”,48“分钟”
我试试这个:
1- i将天数转换为分钟
(13 * 24 * 60)= 18720
2
Dim Result As Double
Result = ((100 - 10) / 100) * 18720
Text3.Text = Result '"text3.text=16848"
现在如何将结果格式化为DD HH NN? 致谢
答案 0 :(得分:0)
像这样使用LEFT / MID / RIGHT关键字
Dim Result As Double
Dim Dayz, Hourz, MinuteZ As String
'
'Using your formula - which i have not checked
Result = ((100 - 10) / 100) * 18720
'
'extract values
Dayz = Left(Result,2)
Hourz = Mid(Result, 3, 2)
Minutez = Right(Result, 2)
'concatenate
Text3.Text = (Dayz & " Days, " & Hourz & " Hours, " & Minutez & " Minutes.")
您还可以查看FORMAT命令。