시간 계산 TimeSpan

VNote 2017.11.08 09:57:52 *: Public Class Form1
Dim StartTime As Date
Dim RunTime As Date

Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click

RunTime = Date.Now.ToString()
Label2.Text = RunTime
Dim myTimeSpan As TimeSpan

myTimeSpan = RunTime - StartTime
If myTimeSpan.TotalMinutes > 0.5 Then '30초 후 true
MsgBox("30초 경과")
Else
MsgBox("30초 이전")
End If

End Sub

Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
StartTime = Date.Now.ToString()
Label1.Text = StartTime
End Sub
End Class