Getting specific Month Records from Date Column in Excel

Hi,

There is a column called Due_Date From this column i need to get the previous two month data.

Date Format:01-10-2019

using select query trying to get data But here the problem is if I am selecting Due_Date Greater than Previous two months,Getting all Months Data After August.

Please specify to get only August Month Data.

image

Regards,
A Manohar

Yah it would actually
So in that case do we know until which date we need to records
Cheers @Manohar1

1 Like

@Palaniyappan

The last date of the month,If the previous Two month is August we need to get the Data for last date(31-08-2019) of august.

Regards ,
A Manohar

Awesome if possible can I see the select method expression you have used so far
Cheers @Manohar1

@Palaniyappan

previousMonth=DateTime.Now.AddMonths(-2).ToString(β€œ01-MM-yyyy”)

FilterDt =duebookHeaderDT.Select(β€œ[Channel]=β€˜CAN’ AND [Actual Due Date] >'”+previousMonth+β€œ'”).CopyToDataTable()

Include one more condition like this
duebookHeaderDT.Select(β€œ[Channel]=β€˜CAN’ AND [Actual Due Date] >’”+previousMonth+β€œβ€™β€ AND [Actual Due Date] <β€™β€œ+Now.AddDays(-(Convert.ToInt32(Datetime.Now.ToString(β€œdd”)))).ToString(β€œdd/MM/yyyy)+”’”).CopyToDataTable()

Cheers @Manohar1

@Palaniyappan getting these error

Put a " Behind yyyy. That should make it work