Guys, I have a query.
I want 5 months start and end date.
For eg. Start date - 01/03/2024 End date 31/03/2024.
I used below code but start date is wrong appears
Today.AddMonths(-5).AddDays(-cint(DateTime.now.ToString(“dd”))-1)
Can someone suggest
Guys, I have a query.
I want 5 months start and end date.
For eg. Start date - 01/03/2024 End date 31/03/2024.
I used below code but start date is wrong appears
Today.AddMonths(-5).AddDays(-cint(DateTime.now.ToString(“dd”))-1)
Can someone suggest
First Date of the 5th previous month
New DateTime(Now.Year,Now.Month,1).AddMonths(-5).ToString("dd/MM/yyyy")
Last Date of the previous 5th month
New DateTime(Now.Year,Now.Month,1).AddMonths(-4).AddDays(-1).ToString("dd/MM/yyyy")
Thanks,
Ashok
Check the below syntax:
Assign Activity -> startDate = New DateTime(DateTime.Now.AddMonths(-5).Year, DateTime.Now.AddMonths(-5).Month, 1).ToString("dd/MM/yyyy")
Assign Activity -> endDate = New DateTime(DateTime.Now.AddMonths(-4).Year, DateTime.Now.AddMonths(-4).Month, 1).AddDays(-1).ToString("dd/MM/yyyy")
Message Box -> "Start Date: " + startDate +Environment.NewLine + "End Date: " + endDate
Hope it helps!!
Thanks @ashokkarale
Its working fine
Thank you @Parvathy @lrtetala @ashokkarale
You guys are awesome.
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.