To Get Date

Hello Guys,

I need to a get 2 month advance starting date and ending date.

ie, if This month is February So i need to get starting date : 01/04/2023 and ending date : 30/04/2023

If the month is march i need to get starting date : 01/05/2023 and ending date : 31/05/2023.

So please help me on this.

HI @Gokul_Murali

Try with this expression

It will get the first date

New DateTime(Now.Year,Now.AddMonths(2).Month,1).ToString(“dd/MM/yyyy”)

It will get the last date

(New DateTime(Today.AddMonths(1).Year,Today.AddMonths(3).Month,1)).AddDays(-1).toString("MM/dd/yyyy")

image

Regards
Gokul

Please refer:

@Gokul001

I got the last date correctly.

But for starting date iam getting error like this.

Hi @Gokul_Murali

Update the double quotation in the expression

New DateTime(Now.Year,Now.AddMonths(2).Month,1).ToString("dd/MM/yyyy")

Regards
Gokul

@Gokul001

Thank you brother for your kind help…

New DateTime(Now.Year,Now.AddMonths(2).Month,1).ToString(“dd/MM/yyyy”)
“01/04/2023”
New DateTime(Now.Year,Now.AddMonths(2).Month,Datetime.DaysInMonth(Now.Year,Now.AddMonths(2).Month)).ToString(“dd/MM/yyyy”)
“30/04/2023”

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