Filter data table by date to get only current month data

Hi ,
Im trying to filtrer data table based on Date to get current month data only. Can someone help me in writting for it.
screenshot has date format

1 Like

Hi @Raj_Kumar1

Dt.Select(“Started '” &“MM”) & "’ ").CopyToDataTable

Hope this helps you!!!

Good day

Hi Shubham,

Thanks for the quick response. Im new to .net and uipath. can you just tell me whats happening inside ?? what is ‘&’ for?

By the way Date format is “MM/DD/YYYY” that you wrote has some syntactical error. I was trying to correct it but as i told you i’m new to .net and uipath i could not.


Hi @Raj_Kumar1

Pass me your XAML file, let me correct it for you!!!

The date format is in “MM/DD/YYYY” though if we want date from current month it’s with “MM”

& is to pass the date in a variable, saying so I understood what was wrong in my query

dt.Select(“Started = ’“MM”) ’ ").CopyToDataTable

If it’s still erring pass me the whole project, I’ll get it sorted :slight_smile:

yah the condition should be like this
–use a assign activity and create a variable like this
in_date = New DateTime(now.year,now.month,1)
then another assign activity like this

DT = DT.Select("[yourcolumnname] > ’ # + in_date.ToString + # ’ ").CopyToDatatable()

yourcolumnname = the columnname here is Started
in_date = The variable that stores the first day of the current month

hope this would help you
Cheers @Raj_Kumar1

Sequence.xaml (10.8 KB)

Input file is of type CSV … I Could not upload it.

Wasn’t able to test it, but try using the following:
Create a month variable with“MM”)

DT.Select("[Started] = ’ # + month.toString + # ’ ").CopyToDatatable()


dt.Select(“[Started] = '” & Month.tostring & "’ ").CopyToDataTable

HI Palaniyappan,
I tried your logic but it copying all rows to new data table.

@Raj_Kumar1 the select query can be used to overwrite on original data base as well!!!

It’s just getting the date sorted out!!! Hope this helps :slight_smile:

Hi @Palaniyappan For my Excel the queries is not working. Could you please help how to figure it out? I need to filter out the current month date.
I have used two ways
1)"[CA Agreed Completion Date] =’"+DateTime.Now.Month.ToString ).CopytoDatatable
2) Using filter wizard activity -> “Column Name” Contains "DateTime.Now.ToString (“MM/yyyy”)

I have declared “CA Agreed Completion Date” as Datetime in buildtable activity.