I have code to parse Date Field only if String is not null or empty but I get the following Exception
Conversion from string " " to type 'Date' is not valid.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidCastException: Conversion from string " " to type 'Date' is not valid.
Source Error:
Line 29:
Line 30: If (Not String.IsNullOrEmpty(last_login)) Then
Line 31: If String.Format("{0:MM/dd/yy H:mm:ss}", last_login) < Now.AddMinutes(-5) Then
Line 32: Return "height:100%;width:100% ;background-color:#FF0000;font-weight: bold; color: #000000"
Line 33: Else
Anyone please explain?