Need to Filter Data of Days Every Month

Hi team,

Here is the current filter expression I am using to extract data for one month. If you see in the below expression, the data will be captured for the month of April, this expression captures one month data.

dt_DataSource.AsEnumerable.Where(function(x) If(x(“Start Dt”).ToString.Trim.Equals(“”),0,Cdate(x(“Start Dt”).ToString).Month).Equals(4)).CopyToDataTable

I want to modify this expression to enable me fetch data of 60 days, starting from the 2nd day of each month.
For example, if I have to run this process from April 2. I need 60 days data from the 2nd of April. This process continues every month. So, I want this to happen dynamically to the “Start Dt” column.

Thanks a lot!

Hi @Sisay_Dinku

how about the following?

StartDate: Type DateTime

New Date(Today.Year, Today.Month, 2)

dtInput: Type DataTable

dtInput.AsEnumerable().Where(Function(x) CDate(x("Start Dt").ToString()).Date >= startDate AndAlso CDate(x("Start Dt").ToString()).Date <= startDate.AddDays(59)).CopyToDataTable()

Regards

@fernando_zuluaga thanks a lot!
It’s worked!!

1 Like

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