Filter date along with other item in Excel

Hi All,

I am facing one issue in which I need to filter the data according to some date along with other parameters.
Here is the steps I have taken

  1. sysDate_LastWeek= DateTime.Now.AddDays(-7)
    Let say I have read the data from excel using read range and now I have the data in variable DT. Date Added is column in DT which have date
  2. DT.Select("[Industry]" LIKE %Utilities% AND [Date Added]>= # +sysDate_LastWeek + # AND [Global Delivery] =β€˜Yes’).CopyToDataTable.

This is how I did that but I am not able to acheive that.

Can anyone tell me how to do it?

Thanks!
Anmol

2 Likes

you were almost done buddy
it should be like this
DT.Select("[Industry]" LIKE β€˜%Utilities%’ AND [Date Added]>= # " +sysDate_LastWeek.ToString + " # AND [Global Delivery] =β€˜Yes’).CopyToDataTable

Cheers @anmolk171

Hi @Palaniyappan

Where is the last double quotes end which is in Bold.

DT.Select("[Industry]" LIKE β€˜%Utilities%’ AND [Date Added]>= # " +sysDate_LastWeek.ToString + " # AND [Global Delivery] =β€˜Yes’).CopyToDataTable

Fine
DT.Select(" [Industry] LIKE β€˜%Utilities%’ AND [Date Added] >= # " + sysDate_LastWeek.ToString + " # AND [Global Delivery] =β€˜Yes’ ").CopyToDataTable

it should be like this buddy
Cheer @anmolk171

Hi @Palaniyappan,

I am getting this error.
RemoteException wrapping System.FormatException: String was not recognized as a valid DateTime. at System.DateTimeParse.Parse(String s, DateTimeFormatInfo dtfi, DateTimeStyles styles)

Can you please suggest?

Thanks!
Anmol

no worries
what is the value of Date Added in the excel and how we are getting in datatable
kindly check with a output datatable activity and use write line activity to check the value of datatable along the column Date Added

This can be resolved with that buddy
Cheers @anmolk171

I did that and it was like 07/09/2019 00:00:00

1 Like

Fine
in that case which is month here and which date here in this
07/09/2019 00:00:100:

@anmolk171

Date is 07 month is 09