In Power Automate, getting the number of days in a specific month can be useful when building workflows that involve date calculations. For example, you might need the last day of the month for deadline setting, reporting, or recurring tasks.
In this tutorial, I will show you how to effectively work with dates in Power Automate, including how to get the number of days in a specific month, retrieve the current and previous month names, and identify the first and last days of the month.
Get Days of Month in Power Automate
I can combine date functions such as formatDateTime and addDays in Power Automate to achieve this. The general approach involves setting a reference to the first day of the next month and subtracting one day to get the last day of the target month.
To do this, follow the below steps:
1. Go to Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

2. Add an Initialize variable action. Then, provide the variable name as Date, type it as a string, and provide a date 2024-10-23 in value.

3. Add a Compose action and provide the below expression to get the number of days in the month; you can subtract the first day of the month from the last day of the month:
formatDateTime(subtractFromTime(addDays(formatDateTime(addToTime(variables('Date'), 1, 'Month'), 'yyyy-MM-01'), -1), 0, 'Day'), 'dd')
Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the days of the month.

Get Current Month Name using Power Automate
In this example, I will show you how to get the current Month name using Power Automate.
1. Go to Power Automate and create an Instant Cloud flow. Choose the trigger flow (i.e., manually trigger a flow).

2. Add a Compose action and provide the below expression to get the current Month name:
formatDateTime(utcNow(),'MMMM')
Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the current Month name.

If you want a month name like Oct, use MMM, and if you want a month in number format, use MM instead of MMMM.
Get the Previous Month Using Power Automate
Suppose you are working on an expense approval flow in Power Automate. At the beginning of every month, your finance department needs a report of the expenses approved in the previous month. In this type of scenario, you are required to know the previous month. Let’s see how to get the previous month:
1. Go to Power Automate and create an Instant Cloud flow. Choose the trigger flow (i.e., manually trigger a flow).

2. Add a Compose action and provide the below expression to get the previous Month name:
formatDateTime(addToTime(utcNow(), -1, 'Month'), 'MMMM')
Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the name of the previous month.

Get the First Day of the Month Using Power Automate
I will show you how to get the first day of the month using Power Automate.
1. Go to Power Automate and create an Instant Cloud flow. Choose the trigger flow (i.e., manually trigger a flow).

2. Add a Compose action and provide the below expression to get the first day of the month:

Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the first day of the month.

Get the Last Day of the Month Using Power Automate
To get the last day of the month in Power Automate, you can use the addDays() and formatDateTime() functions. Here’s a formula that calculates the last day of the current month:
Go to Power Automate and create an Instant Cloud flow. Choose the trigger flow (i.e., manually trigger a flow). Then Add a Compose action and provide the below expression to get the last day of the month:
formatDateTime(addDays(startOfMonth(addToTime(utcNow(), 1, 'Month')), -1), 'dddd')
Save the flow and run it manually. Once it runs successfully, click the Compose action to see the last day of the month.

Get the Current Day of Week Using Power Automate
To get the current day of week flows the below steps:
In the Power Automate, create an Instant Cloud flow. Choose the trigger flow to trigger a flow manually. Then Add a Compose action and provide the below expression to get the current day of the week:
dayOfWeek(utcNow())
Save the flow and run it manually. Once it runs successfully, click the Compose action to see the current day of the week.

Get Current Hours Using Power Automate
To get current hours, create an Instant Cloud flow by manually trigger a flow, then add a compose action using the below expression:
formatDateTime(utcNow(),'hh:mm tt')
Save the flow and run it manually. Once it runs successfully, click the Compose action to see the current hours.

Get the First Day of Next Month in Power Automate
Imagine you work for a company that provides subscription services. The billing cycle starts on the first day of each month, and you want to automate an invoice generation process using Power Automate. You need to know by the first day of next month to do this. Now follow the below steps:
1. Go to Power Automate and create an Instant Cloud flow. Choose the trigger flow (i.e., manually trigger a flow).

2. Add a Compose action and provide the below expression to get the first day of next month:
formatDateTime(startOfMonth(addToTime(utcNow(), 1, 'Month')), 'dddd')
Save the flow and run it manually. Once it runs successfully, click the Compose action to see the first day of the next month.

Get the Last Day of Previous Month Using Power Automate
Now, I will tell you how to get the last day of the previous month using Power Automate.
In the Power Automate, create an Instant Cloud flow. Choose the trigger flow to trigger a flow manually. Then Add a Compose action and provide the below expression to get the current day of the week:
formatDateTime(subtractFromTime(startOfMonth(utcNow()), 1, 'Day'), 'dddd')
Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the days of the previous month.

Get First Day of the Year Using Power Automate
To get the day of the week (like “Monday,” “Tuesday,” etc.) from a specific year using Power Automate, you can follow the below steps:
1. Go to Power Automate, click the Instant Cloud flow, enter the Flow name, and choose the trigger flow (i.e., manually trigger a flow).

2. Add an Initialize variable action. Then, provide the variable name as varYear, type it as a string, and provide a date of 2024 in value.

3. Add a ‘Compose’ action using the expression below, which will give us the first date of the specified year:
concat(variables('varYear'), '-01-01')
4. Again, add a ‘Compose’ action and provide the expression below to get the first day of the year:
formatDateTime(outputs('Compose'),'dddd')
Now, click Save and run the flow manually. Once it runs successfully, click the Compose action to see the first day of the year.

In this tutorial, I explained various methods in Power Automate for working with dates, including retrieving the number of days in a month, getting the current and previous month’s names, and finding the first and last days of a month. These techniques utilize date functions such as formatDateTime, addDays, and subtractFromTime to perform essential date calculations.
Related Power Automate tutorials:
- Add Days to Date in Power Automate
- Get Start and End of Month in Power Automate
- Get Current and Previous Months in Power Automate
- Calculate the Last Working Day Of a Month Using Power Automate
- Get Current Date in Power Automate
- Get Email Address From Name in Power Automate

After working for more than 18 years in Microsoft technologies like SharePoint, Microsoft 365, and Power Platform (Power Apps, Power Automate, and Power BI), I thought will share my SharePoint expertise knowledge with the world. Our audiences are from the United States, Canada, the United Kingdom, Australia, New Zealand, etc. For my expertise knowledge and SharePoint tutorials, Microsoft has been awarded a Microsoft SharePoint MVP (12 times). I have also worked in companies like HP, TCS, KPIT, etc.