I am having problems converting the difference of two dates into an integer from double. I have the following code:
Dim date1, date2 as date
Dim dateDiff as timespan
Dim i as integer = 0
date1 = "20/07/2006"
date2 = "05/08/2006"
dateDiff = date2.subtract(date1)
Dim intDateDiff as integer = cType(dateDiff, integer) ' also tried cInt(datediff)
Then I want to use intDateDiff in some code like:
For i = 0 to intDateDiff
I get the following error converting timespan to integer
Error 3 Value of type 'System.TimeSpan' cannot be converted to 'Integer'.
Any ideas how to get an integer from two dates.