Select date in dt

Hello all!

In my datatable i’ve a column “Expire Date”, containing the list of dates in this format (dd/MM/yyyy hh:mm).

I should, via a select, extrapolate all rows that contain a date between a date I input and the date of the day before execution (now -1)

I am currently using this select to fetch all the dates of the previous day.

(From d in datatable.AsEnumerable
Let dp = CDate(d(“Expire Date”).ToString.Trim).Date
Where dp = MyDateString.Date
Select r = d).ToList

How can I change it so that it returns all dates from my date to date -1?

Last thing: in the excel sheet it is reported in this format: dd/MM/yyyy, why when I read it from uipath does it read it in the format MM/dd/yyyy, what does it depend on?

Thanks in advance

Use datetime.parseexact to specify the format of the date

Dear @Kumar802 ,
Go check this one.
It will check if the date in the excel between the entered date and 1 day before today. And just need to put whatever u want in true condition.

Select Row With Required DateTime.xaml (9.6 KB)
Expected.xlsx (9.2 KB)

And for the last question : the date format from the excel sheet is based on your computer region format for date.

Hello @Kumar802

If you are getting a value from DataTable it will be in string format. So you need to first convert that to datetime format and need to substract by one. Can watch the below video to understand the conversation of string date to datetime format.

How to Convert String to DateTime in UiPath?| Methods of conversion| Practical demo & Tutorial

hi felix,

thanks. Which package have you used?

the region is set to dd/MM/yyyy but when the data is read from excel the result is MM/dd/yyyy, what setting on windows should I check?

Hi @Kumar802 ,
I don’t get it on “which package have u used??” i didn’t use any kind of package i think, just use neutral activity.

Btw for the settings, if u’re on Windows 10, just go to Start, and type Region.
When it’s opened, then click “Change data formats”, and “Short date”. As i know, that’s should be the one that impact on date formating.