Dim Start1 As Date, Stop1 As Date
Dim Harga As Integer, Biaya As Integer
Function DateDiffX(dStart As Date, dEnd As Date, Optional bDetailed As Boolean) As Variant
Dim TotalDays
Dim Years, Months, Days, hours, minutes, seconds
If bDetailed Then
TotalDays = dEnd - dStart
hours = Hour(dEnd - dStart)
minutes = Minute(dEnd - dStart)
seconds = Second(dEnd - dStart)
If hours < 10 Then
hours = "0" & hours
ElseIf hours > 9 Then
hours = hours
End If
If minutes < 10 Then
minutes = "0" & minutes
ElseIf minutes > 9 Then
minutes = minutes
End If
If seconds < 10 Then
seconds = "0" & seconds
ElseIf seconds > 9 Then
seconds = seconds
End If
DateDiffX = hours & ":" & minutes & ":" & seconds
Exit Function
End If
End Function
Private Sub Command1_Click()
If Command1.Caption = "Mulai" Then
Command1.Caption = "Stop"
Timer1.Enabled = True
lblMulai = ": " & Format(Time, "hh:mm:ss")
ElseIf Command1.Caption = "Stop" Then
Command1.Caption = "Mulai"
Timer1.Enabled = False
lblSkrg = ": " & Format(Time, "hh:mm:ss")
End If
End Sub
Private Sub Command2_Click()
Unload Me
End Sub
Private Sub Form_Load()
Start1 = Format(Time, "hh:mm:ss")
Harga = 10
End Sub
Private Sub Timer1_Timer()
Stop1 = Format(Time, "hh:mm:ss")
lblSkrg = ": " & Format(Time, "hh:mm:ss")
lblDurasi = ": " & DateDiffX(Start1, Stop1, True)
Timer1.Tag = Biaya + Harga
lblBiaya = ": Rp. " & Timer1.Tag
Biaya = Timer1.Tag
End Sub
Tidak ada komentar:
Posting Komentar