Asanka
1
Hey,
I have a table extract that has dates stored as strings. They come in the format of 17/03/2020. I was able to convert those into dates using:
row(1) = Date.ParseExact(row(1).ToString, “dd/MM/yyyy”, System.Globalization.DateTimeFormatInfo.InvariantInfo)
That would change it from 17/03/2020 to 03/17/2020 00:00:00
However, now I cannot take todays date and subtract it from that date. I’m trying to use it in an if block:
IF
date.now - row(1) > 1095
Then…
I can’t get it to work. I tried different variations of converting the row(1) to dbl and integer but no luck
use a separate variable for that date
Asanka
4
i can get the date.now portion to work but the row(1) wont
Thats for the IF statement
Asanka
6
its 3 years (365 days * 3)
Asanka
7
i’ve tried converting row(1) into both an integer and a double but it says:
Assign: Conversion from string “03/17/2020 00:00:00” to type ‘Double’ is not valid.
varAttribute=DateTime.ParseExact(row(1).ToString, “dd/MM/yyyy”,System.Globalization.DateTimeFormatInfo.InvariantInfo)
if ((DateTime.Now-varAttribute).TotalDays>1095)
Asanka
9
what type of variable does varAttribute need to be?
Asanka
11
Great that worked! Thank you so much!
system
(system)
Closed
12
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.