TimeSpan 可以計算出兩個日(前減後)期間的時間差
Dim Date1 As New Date(2013, 6, 1, 12, 5, 5) '2013/6/1 12:05:08
Dim Date2 As New Date(2013, 5, 1, 10, 0, 0) '2013/5/1 10:00:00
Dim _timeSpan As TimeSpan = Date1.Subtract(Date2)
Dim differentDays As Integer = _timeSpan.Days
'--- differnet Day=31
Dim differentHours As Integer = _timeSpan.Hours
'--- different Hours=2
Dim differentMins As Integer = _timeSpan.Minutes
'--- different Mins=5
Dim differentSec As Integer = _timeSpan.Seconds
'--- different Sec=8
MSDN TimeSpan
留言