时间计算器
时间计算器
用VB写个计算(加减)时间软件.
要求如下:
1:
lable1(开始时间)
label2(结事时间)
text1(开始时间(时))
label3(:)
text2(开始时间(分))
text3(结束时间(时))
label4(:)
text5(结束时间(分))
label5(显示总计时间)
label6(显示总金额)
command1(计算)
2:
计算精确到分钟!
3:
计算时间
比如:11点55分到18点10分中间用了多少小时多少分
然后然后再乘以每小时2.5元,把结果分输出到label5和label6
Private Sub Command1_Click()
Dim st As Date
Dim ed As Date
st = CDate(Text1.Text & ":" & Text2.Text)
ed = CDate(Text3.Text & ":" & Text4.Text)
Dim v As Double
Dim m As Long
m = DateDiff("n", st, ed)
v = m * 2.5
Label5.Caption = "总计时间" & m & "分钟"
Label6.Caption = "总金额" & v
End Sub
Private Sub Form_Load()
Label1.Caption = "开始时间"
Label2.Caption = "结事时间"
Text1 = ""
Label3.Caption = ":"
Text2 = ""
Text3 = ""
Label4.Caption = ":"
Text4 = ""
Label5.Caption = "总计时间"
Label6.Caption = "总金额"
Command1.Caption = "计算"
End Sub