I am getting exception on following lines
InspectionDate = "07/15/2014"
If CType(InspectionDate, Date) > Date.Today Then
'Here comes my logic etc
'Here comes my logic etc
'Here comes my logic etc
End If
When i debugged i see Date.Today = #7/15/2014#
Can any one please help on this.
Thanks..
Try like this
Dim dt As Date = Date.ParseExact("07/15/2014","MM/dd/yyyy", CultureInfo.InvariantCulture);
IF dt > Date.Today Then
'CODE HERE
END IF
Check the full documentation at msdn
InspectionDate = "07/15/2014"
If DateTime.Parse(InspectionDate) > Date.Today Then
'Here comes my logic etc
'Here comes my logic etc
'Here comes my logic etc
End If
try like this
Before compare both dates use the TryParse method
Dim dateValue as Date
InspectionDate = "07/15/2014"
If (Date.TryParse(InspectionDate, dateValue) > Date.Today Then
'your code here
End If
check the metod in the MSDN check the description
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.