Use of contains key word in select statement

i have two data table and datetime as a datetype need to check and compare the values of Datetime

i thought of converting the value of the datetime column to string and use = and which am not able to perform. any suggestions for the same…??

how to use contains key word in select statement in UIpath…??

Thank you


Yes you can do the same way but before that check the format of the date and time… if u want to check date alone use toshortdatestring()



I’m not understanding your problem fully.

If you would like to compare the datetime, I would recommend keeping it as a datetype so the format is consistent and let’s you compare dates together.
So you can do for example, datetime = Now or datetime < Now

If you do want to convert to string then you can do datetime.ToString or .ToShortdatestring like Arivu mentioned :stuck_out_tongue:

If you would like to filter a date table by the datetime, then I would suggest looking at the .Where method which let’s you use = and .Contains and all other functions you are used to using.
An example of that is here:

datatable.AsEnumerable.Where(Function(row) CDate(row("Date")) = Now ).ToArray

Then, you can perform For each loop on that array of datarows. Or change .ToArray to .CopyToDataTable for a new table.

I hope this is clear.



@Divyashreem, converting that entire column to string can be done as follow,

Datatable.Asenumerable(). Select ("Convert(ColName,System.string) = ‘string value’ "). CopyToDatatable

1 Like