2010年10月19日 星期二

執行使用時間 , 分和秒

Public Class Form1
Dim day_a As DateTime = Now
Dim day_b As DateTime
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
day_b = Now
Dim m_int As Integer = CInt(DateDiff(DateInterval.Second, day_a, day_b) / 60)
Dim s_int As Integer = DateDiff(DateInterval.Second, day_a, day_b) Mod 60
Dim ms_str As String = " 共" & m_int & "分" & s_int & "秒"
MessageBox.Show(ms_str)
End Sub

End Class

沒有留言:

張貼留言