Dim string_date As String
string_date="31/03/2014"
string_date を「dd/MM/yyyy」形式の日付に変換して現在の日付と比較する方法
DateTime.TryParseExact() を使用します。
Dim string_date As String = "31/03/2014"
Dim dt As DateTime
If DateTime.TryParseExact(string_date, "dd/MM/yyyy", Nothing, Globalization.DateTimeStyles.None, dt) Then
Debug.Print("dt = " & dt.ToString("D"))
If dt.Equals(DateTime.Today) Then
Debug.Print("Equal to Today")
Else
Debug.Print("Not Equal to Today")
End If
End If
最後に、私は自分の解決策を得ました。
d1 as date
string_date as string
string_date="31/03/2014"
d1 = Date.ParseExact(string_date, "dd/MM/yyyy", Globalization.CultureInfo.InvariantCulture)