Hello,
I want to find if today’s date is between 7th and 30th of the month and if this condition is true want to write today’s date if not I want to write last day of the month.
Any advice?
Thank you.
HI @makboga
How about this expression?
New DateTime(Now.Year, Now.Month, Now.Day) > New DateTime(Now.Year, Now.Month, 7) And New DateTime(Now.Year, Now.Month, Now.Day) < New DateTime(Now.Year, Now.Month, 30)
Workflow Screenshot
Then → DateTime.now.ToString("dd-MM-yyyy")
Else → (New DateTime(Today.AddMonths(1).Year,Today.AddMonths(1).Month,1)).AddDays(-1).toString("dd-MM-yyyy")
Output
Regards
Gokul
It is working thank you
Mark it as Solution Bro
we assume that some dynamics are expected and when months do have a different end date like 31,28/29 the statement should also work
we could reformulate also the requirement:
When checkDate (e.g. Today) Day In Month < 7
Then: Today
Else: last Day of current month
So we can formulate this oneliner:
IF(now.Day < 7, now.AddDays(- now.Day + 1).AddMonths(1).AddDays(-1).Date, now.Date)
Other case test:
A february test case:
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.