Syntax :
timeValure ( timestring$ )
timestring$ : Text string to convert that is an acceptable time value
Examples of valid timeString value
timestring$
3:05
3:05:23
03:05:23
15:05
3:03 pm
3:05 AM
October 6, 2010 3:05 am
timeValure ( timestring$ )
timestring$ : Text string to convert that is an acceptable time value
Examples of valid timeString value
timestring$
3:05
3:05:23
03:05:23
15:05
3:05 AM
October 6, 2010 3:05 am
Option Explicit
Private Sub Command1_Click()
Dim EndTime, FirstTime, T
Dim Seconds$
Start:
On Error GoTo NotTime
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "Please Enter a tim in each box."
Exit Sub
End If
FirstTime = TimeValue(Text1.Text)
EndTime = TimeValue(Text2.Text)
Text1.Text = Str$(FirstTime)
Text2.Text = Str$(EndTime)
T = EndTime - FirstTime
Seconds$ = Str$(Int(T * 86400))
Label1.Caption = Seconds$ + " seconds "
Exit Sub
NotTime:
MsgBox "Please Enter a value Time."
Text1.Text = ""
Text2.Text = ""
Resume Start
End Sub
Private Sub Command1_Click()
Dim EndTime, FirstTime, T
Dim Seconds$
Start:
On Error GoTo NotTime
If Text1.Text = "" Or Text2.Text = "" Then
MsgBox "Please Enter a tim in each box."
Exit Sub
End If
FirstTime = TimeValue(Text1.Text)
EndTime = TimeValue(Text2.Text)
Text1.Text = Str$(FirstTime)
Text2.Text = Str$(EndTime)
T = EndTime - FirstTime
Seconds$ = Str$(Int(T * 86400))
Label1.Caption = Seconds$ + " seconds "
Exit Sub
NotTime:
MsgBox "Please Enter a value Time."
Text1.Text = ""
Text2.Text = ""
Resume Start
End Sub
No comments:
Post a Comment