W
William Foster
Good afternoon all,
I am trying to convert a date to an integer in Microsoft Visual Basic
2003 .NET and am experiencing a little trouble trying to get it done.
This is what I want to do:
Date_001 = Array_001(0)
Date_002 = Array_001(1)
If (Date_001 - Date_002) <= Array_002(i, 0) Then
Value_Reference = i
Value_Found = True
Exit For
Else
End If
However, I have to convert the Date_001 and Date_002 variables to
Decimals or Integers before I can do this
If (System.Convert.ToDecimal(Date_001) -
System.Convert.ToDecimal(Date_002)) <= Array_002(i, 0) Then
I have tried using the Change type, but this returns a 'Run-time
exception thrown : System.InvalidCastException - Cast from type 'Date'
to type 'Integer' is not valid.' error.
(Convert.ChangeType(Creation_Date, GetType(DateTime)), Integer)
Any assistance you may be able to provide would be greatly appreciated.
Yours sincerely,
William Foster
I am trying to convert a date to an integer in Microsoft Visual Basic
2003 .NET and am experiencing a little trouble trying to get it done.
This is what I want to do:
Date_001 = Array_001(0)
Date_002 = Array_001(1)
If (Date_001 - Date_002) <= Array_002(i, 0) Then
Value_Reference = i
Value_Found = True
Exit For
Else
End If
However, I have to convert the Date_001 and Date_002 variables to
Decimals or Integers before I can do this
If (System.Convert.ToDecimal(Date_001) -
System.Convert.ToDecimal(Date_002)) <= Array_002(i, 0) Then
I have tried using the Change type, but this returns a 'Run-time
exception thrown : System.InvalidCastException - Cast from type 'Date'
to type 'Integer' is not valid.' error.
(Convert.ChangeType(Creation_Date, GetType(DateTime)), Integer)
Any assistance you may be able to provide would be greatly appreciated.
Yours sincerely,
William Foster