參考引用來源:checking if string is a date in yyyyMMdd format
--
Dim ds As String = "20140706"
Dim dt As DateTime
If DateTime.TryParseExact(ds, "yyyyMMdd", System.Globalization.CultureInfo.InvariantCulture, _
DateTimeStyles.None, dt) Then
MessageBox.Show("Date is " & dt.ToString)
Else
MessageBox.Show("Invalid date")
End If
沒有留言:
張貼留言