Filter current date only

I need to filter the latest date from Data table column “appointmentdate”.

Hi @Henson_Ibon

You can use the following query:

dt.AsEnumerable.Where(Function(row) row("appointment date").ToString.Equals(Now.ToString("MM/dd/yyyy")).CopyToDataTable

Hope this helps,
Best Regards.


Hope the below steps would help you resolve this

  1. Use read range activity and get the datatable as dt
  2. Now use a ASSIGN ACTIVITY like this

dt = dt.AsEnumerable().Where(Function(a) a(“yourcolumnname”).ToString.SubString(0,10).Equals(Datetime.Now.ToString(“dd/MM/yyyy”)).CopyToDatatable()

I m assuming after reading the excel the first 10 characters of date read will be in this format dd/MM/yyyy

Check that once and then mention the format accordinly in the above expression

Cheers @Henson_Ibon


You can use filter excel activity …and procide filter as Now.ToString("MM/dd/yyyy")



You can place a breakpoint after you had the datatable variable

Now check in locals how the data value is displaying

Use Filter Activity and write in column as “appointmentdate”

If you are getting the as it is value in locals also then you can write as Now.ToString(“MM/dd/yyyy”)

Hope this may help you


how do you check in locals?


Set a break point where you require by right clicking on the activity

Then run the file in debug mode

Then when the bot pauses near breakpoint on the left aide you would see locals panel, which contains variables you have and can open and see the values


When u run debug mode u can see the value read from excel along with the variable



Put a breakpoint and debug the file

Once you are running the file you are paused and left side you see the locals tab where you can see the value of the variable

Hope this may help you


Hi @Henson_Ibon ,

It does look like all of your values are in one format, but if there are possibilities that an Empty value would be present in the Date, then we could use the below Expression :

FilteredDT = DT.AsEnumerable.Where(Function(x)Not String.IsNullOrWhiteSpace(x("appointmentdate").ToString) andAlso CDate(x("appointmentdate").ToString).Date=Now.Date).CopyToDatatable

For Handling of direct CopyToDatatable, you can check the below post :

this is the result of the debug but it still does not provide the output

where will I put this in the code?

@Henson_Ibon ,

You can use it within an Assign Activity The Left Part of the = is to be added in the L.H.S of the Assign and and the Right Part of the = to the R.H.S of the Assign activity.

Also, Note that the FilteredDT is a Datatable type variable and DT is your Input Datatable.


Can you check the DT variable not the currentDate

Because you need to filter the Datatable right?


Many thanks. Already got the result.

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.