i have a little task that gets a datatable dt_A of an excel file.
This table will be filtered getting a row only.
After i get the value of the item from this dt_A , located in a string column called “Fecha” which is in this format “dd/MM/yyyy” (its not posible to provide the column in date format due project requirements so i must do it like this)
dt_WithActivityDate.Rows(0).Item(3).ToString
After i ihave to filter a second datatable dt_B (from another workbook) wich have also a column called “Fecha” and i have to use the date extracted previously to filter this dt_B
but UiPath returns the date in an invalid format for me “MM/dd/yyyy” , making the second filter datatable activity fail or getting wrong results
yes i have seen this post but i that i need is more simple than this, perhaps if i could filter the datable in another way… i tried also doing this (and i would like to do in this way):
Sorry for my mistake
the data table posted ,dt_WithActivityDate, is the dt that i called dt_A for this example , which contains the date that i need to format and use to filter in the dt_B
dt_WithActivityDate is dt_A → which contains only a row (posted above)
Replace yourDateString with the variable or expression that contains your date in “MM/dd/yyyy” format.
For example, you can assign the converted date to a new variable like this:
Dim convertedDate As String = DateTime.ParseExact(yourDateString, "MM/dd/yyyy", System.Globalization.CultureInfo.InvariantCulture).ToString("dd/MM/yyyy")
Now, convertedDate will hold the date in the “dd/MM/yyyy” format, which you can use to filter the second datatable dt_B.
Both dt_A and dt_B has the date in the same format MM/dd/yyyy (month/date/year). So you should be able to compare the dates without converting them. Strange.