mathieu_cupryk
asked on
Comparing string to datetime.
I have the following:
Dim value As String = String.Empty
value = filename.Substring(4, 11)
value = 20090210
I need to compare this to datetime and return true if older than 7 days.
Dim value As String = String.Empty
value = filename.Substring(4, 11)
value = 20090210
I need to compare this to datetime and return true if older than 7 days.
dim dt as new date(value.substring(0,4), value.substring(4,2),value .substring (6,2))
if dt < date.today.adddays(-7) then
'older then 7 days
endif
if dt < date.today.adddays(-7) then
'older then 7 days
endif
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
This should do what you need.
value = "20090210"
Dim dt As DateTime = New DateTime(Int32.Parse(value
Int32.Parse(value.Substrin
Int32.Parse(value.Substrin
Dim ts As TimeSpan = dt - Today
If ts.Days > 7 Then
' Delete your files in here
End If
Fernando