2006-10-11 16:15:38心靈季動

算出時間的差距

TimeSpan:時間間隔
很好用唷...

DateTime NowDate = DateTime.Now;
DateTime OldDate = DateTime.Parse(”2005-10-11”);

TimeSpan ts = NowDate - OldDate;

”目前相距” + ts.Days + ”天” + ts.Hours + ”小時” + ts.Minutes + ”分”;
黃禹翔 2009-10-29 11:57:53

這樣子更精準…跟你分享

Dim st As Double = DateAndTime.Timer
For i As Integer = 0 To 10000000
If i Mod 2 Then
Dim a As String = Nothing

End If
Next
Dim et As Double = DateAndTime.Timer
Response.Write("執行迴圈" & (et - st))