To get Current Date and Next Month date

Hi everyone,
I have to get this month date as current date and from current needs to calculate next month date as End Date like today is 31/1/2022 so the end date will be 28/2/2022 and if it is 2/2/2022 then end date will be 2/3/2022 and also if it is 31/12/2022 then end date will be 31/1/2023 and so on… I am able to handle year end scenario but not able to handle feb month scenario. Please help.
I created one flow:
image
image


but unable to handle feb month scenario, it is showing like this…
image

Please help me to achieve this.

Thank you in advance.

1 Like

Hi

Have a view on this post for complete idea on Datetime

Meantime let me try to figure out the exact expression

Cheers @Anjali_Rani

1 Like

As I understand, when you use AddMonths(+1) it’s returning to you an invalid date (31/02/2022).
What you could do is: if the final date is day 31, you could assing to a variable the value of the first day of the nexth month (01/03/2022) and do a addDays(-1). That you give you the real last day of the previous month, and so you can fix this.
I don’t know if it is the best solution, or if will work on everycase, but it might help.

@Anjali_Rani

Try as below

image

Now.AddMonths(1).ToString(“dd/MM/yyyy hh:mm”)

Hope this will help you

Thanks

1 Like

please check your requirement as next month and end of month is mixed up
grafik

a defensive implementation of getting next month end we can do
grafik

Also have a look on this next year handling
grafik

1 Like

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