How to get the previous day, the first day of the month, the last day of the month, and the number of days in the month.
Steps
In this example, the target date of the flow execution is retrieved.
However, it can be applied to any other date by changing the date used for the action.
The date can be text in yyyy-MM-dd format.
Previous day
Set up a "Subtract from time" action and configure it as follows.
Parameter | Value |
---|---|
Base time | Target date and time. |
Interval | 1 |
Time unit | Day |
First day of the month
Set up a "Convert time zone" action and configure it as follows.
End of Month Day
The first step is to create the first day of the month for the following month.
Set up an "Add to time" action and configure it as follows.
Parameter | Value |
---|---|
Base time | First day of the month. |
Interval | 1 |
Time unit | Month |
The dynamic content "Calculated Time" in "Add to time" will be on the first day of the next month.
Then set up "Subtract from time" and set as follows.
Parameter | Value |
---|---|
Base time | First day of the next month. |
Interval | 1 |
Time unit | Day |
The dynamic content "Calculated Time" in "Subtract from time" is the last day of the month.
Number of days in month
Use the month end date created in the previous step.
Set up "Initialize variable" and configure as follows.
Parameter | Value |
---|---|
Type | Integer |
Value | @dayOfMonth(body('Subtract_from_time')) |
For those who want to learn Power Automate Cloud flow effectively
The information on this site is now available in an easy-to-read e-book format.
Or Kindle Unlimited (unlimited reading).
You willl discover how to about basic operations.
By the end of this book, you will be equipped with the knowledge you need to use Power Automate Cloud flow to streamline your workflow.
Discussion
New Comments
No comments yet. Be the first one!