How to compare Date Column to a String Variable

Hi,

Presently I am selecting the entire column of Date and comparing with a string variable

FilterdDt=Dt1.select("[Date_Column]=‘resigned’").copytoDatatable

while excuting getting these following error.

image

please help me in solving

Regards,
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

@Palaniyappan

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.

Regards,
A Manohar

Try with this expression
FilteredDt.Equals(Dt1)

Cheers @Manohar1

@Palaniyappan

The result What I am expecting is
1.Reading a Excel and storing in Datatable Dt1
2.in 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