Sample comparing two dates:
Dim t1 As String = DateTime.Parse("3:30 PM").ToString("t") Dim t2 As String = DateTime.Now.ToString("t") If DateTime.Compare(DateTime.Parse(t1), DateTime.Parse(t2)) < 0 Then Response.Write(t1.ToString() & " is < than " & t2.ToString()) Else Response.Write(t1.ToString() & " is > than " & t2.ToString())End If
Sample comparing two moments in time:
Dim adate As DateTime = DateTime.Parse("06/24/2003") Dim bdate As DateTime = DateTime.Parse("06/28/2003") Dim ts As New TimeSpan(bdate.Ticks - adate.Ticks) Response.Write(ts.TotalDays & "<br>") Response.Write(ts.TotalHours & ":" & ts.TotalMinutes & _ ":" & ts.TotalSeconds & ":" & ts.TotalMilliseconds)