How to compare Date Column to a String Variable


Presently I am selecting the entire column of Date and comparing with a string variable"[Date_Column]=‘resigned’").copytoDatatable

while excuting getting these following error.


please help me in solving

A Manohar

may i know what is the datatype of FilterDt and the Dt1 must be datatable
are we trying to compare two datatable then its fine
else we need to validate this eexpression

Cheers @Manohar1

1 Like


Both FilterdDt and Dt1 are of Datatype Datatable.

what I am doing here is comparing the entire Date_Column of Datatype Date with a string variable.

A Manohar

Try with this expression

Cheers @Manohar1


The result What I am expecting is
1.Reading a Excel and storing in Datatable Dt1 Dt1 there are many columns from that one column is Last_Date Column of Datatype Date.
3.Now i need to compare the Last_Date Column with the string resigned, later compared Data is stored in FilteredDt.

while comparing I am getting the above error

Hope you got it.

Hey Manohar,

you can not compare DateTime with a String. You should convert one variable and then compare the same types.

Converting to String is quick and easy. Converting to DateTime can be a little tricky, but allows you to do more operations with the date. For example add or subtract days or months to your date, finding out if your date is before or after another date, or simply getting the name of the weekday on this date.

Cheers, Lukas