Date
aが過去のものかどうかを判断する最良の方法は何ですか?
現在私は持っています:
If MyDate < Date.Now
同じタイムゾーンで働いていると仮定します。
これを行う方法を示す小さなコード スニペットを次に示します。
Dim MyDate As Date = #11/4/2012#
Dim ts As TimeSpan = MyDate.Subtract(Today)
If ts.TotalDays < 0 Then
MsgBox("MyDate is in the past")
ElseIf ts.TotalDays > 0 Then
MsgBox("MyDate is in the future")
Else
MsgBox("MyDate is today")
End If