In this Power Automate tutorial, we will see how to get days of month in Power Automate or Microsoft flow. And also we will discuss the below points:
- Get the days of the month Power Automate
- Power automate get current month name
- Power automate get previous month
- Power automate get first day of month
- Power automate get last day of month
- Power automate get previous year
- Power automate get day from date
- Power automate get day of week
- Power automate get current day
- Power automate get hour
- Power automate get date only
- Power automate get first day of next month
- Power automate get last day of previous month
Get days of month using Power Automate
Here we will see how to get the days of a month in Power Automate. And also we will check whether this year is a leap year or not on a given date.
In Power Automate, select the Manually triggered flow, then click on the Next step.
Next step we will provide a date, based on that date it will get the days of the month and also we will check that year is a leap year or not. Select Initialize variable action, then provide the variable name, type as string, and in value give a date.
Next, we will get the year from the given date, so click on the Next step, and select initialize variable action, the provide the variable name, type as integer, and in value write the below expression:
int(formatDateTime(variables('mydate'), 'yyyy'))
Now we will get the month from the given date, so click on the Next step and select initialize variable action, then provide the variable name, type as integer, and in value write the below expression:
int(formatDateTime(variables('mydate'), 'MM'))
Now we will check the given year in date is a leap year or not, so click on the Next step and select Compose action, then in input, write the below expression:
or(and(equals(mod(variables('yr'), 4), 0), not(equals(mod(variables('yr'), 100), 0))),
equals(mod(variables('yr'), 400), 0))
Now we will find the days in the given month, so click on the Next step, select Compose action, then in input write the below expression:
if(equals(variables('mnth'),2), if(outputs('IsLeapYr'), 29, 28), if(or(equals(variables('mnth'),1), equals(variables('mnth'),3), equals(variables('mnth'),5), equals(variables('mnth'),7), equals(variables('mnth'),8), equals(variables('mnth'),10), equals(variables('mnth'),12)), '31', '30'))
Now click on Save and run the Flow manually, and you can see 2022 is not a leap year, so it returns false, and also it returns the no of days present in the given month.
This is an example of get the days of the month Power Automate.
Read How to convert word to pdf using Power Automate
Power automate get current month name
Here we will see how to get the current month name using Power Automate.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Now we will provide the current date, to get the current month, so select the Compose action, then in Input provide the below expression.
formatDateTime(utcNow(),'MMMM')
Now click on Save and run the Flow manually you can see the current month in Power Automate.
This is an example of Power automate get current month name.
Power automate get previous month
Here we will see how to get previous month using Power Automate or Microsoft flow.
In Power Automate, select the Manually triggered Flow, then click on the Next Step.
Now we will get the previous month, so select Add to time action, then in Base time provide the below expression:
utcNow()
Then in interval provide -1, and time unit select Month because we are calculating previous month.
Next, we will convert the above calculated time into the required time zone and format the time to get the previous month’s name. So click on the Next step and select the Convert time zone action.
Then provide base time from the dynamic content, source time zone, destination time zone, and Format the string as MMMM.
Now click on Save and run the flow manually, and you can see the Previous Month name.
This is an example of power automate get previous month.
Read Power Automate export SharePoint list to excel and send an email
Power automate get first day of month
Here we will see how to get first day of the current month using Power Automate.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Next, select a Compose action, then in Input write the below expression to calculate the first day of the month.
formatDateTime(startOfMonth(utcNow()),'dddd')
Now click on Save and run the flow manually, you can see the result first day of the month.
This is an example of power automate get first day of month.
Read Power Automate delete all items in SharePoint list
Power Automate get last day of month
Here we will see how to get last day of a month using Power Automate.
So here we will first get the next month, then we will get the start date of the next month and at last, we will subtract a day from the start date of the next month, to get the last day of the current month.
In Power Automate, select the Manually triggered flow, then click on the Next step.
Now we will calculate the start date of the Next month, so select Add to time action, then in Base time provide the below expression:
utcNow()
Then in Interval provide 1, and the time unit is Month.
Then click on the Next step, and select Compose action, then in Input write the below expression, to get the last day of the current month.
addDays(startOfMonth(body('NextMonth')),-1,'MM-dd-yyyy')
Now click on Save and run the flow manually, and you can see the last day of the current month.
This is an example of Power Automate get last day of month.
Read The specified object was not found in the store Power Automate
Power Automate get previous year
Here we will see how to get previous year using Power Automate.
In Power Automate, select the Manually triggered Flow, then click on the next step.
Now we will get the current year, so click on the Next step and select the Initialize variable action, provide the variable name, type as a string, and in value write the below expression:
formatDateTime(utcNow(),'yyyy')
Now we will get the previous year, so click on the Next step and select in Compose action, then in Input write the below expression:
sub(int(variables('CurrentYear')),1)
Now click on Save and run the flow manually and you can see the previous year in the output of compose action.
This is an example of Power Automate get previous year.
Read How to get email address from name in Power Automate
Power Automate get day from date
Here we will see how to get day from date using Power Automate.
In Power Automate, select the Manually triggered Flow, then click on the Next step.
Now we will get the current day from the date, so select initialize variable action, then provide the variable name, type as String, and in value write the below expression:
formatDateTime(utcNow(),'dddd')
Now click on Save and run the Flow manually, you can see the day in the below screenshot.
This is an example of Power automate get day from date.
Read Power Automate copy files with Examples
Power Automate get day of week
Here we will see how to get current day of week using Power Automate.
In Power Automate select the Manually triggered flow, then click on the Next step.
Now we will store the current date in a variable, so select the Initialize variable action, the provide the variable name, type as string, and in value write the below expression.
utcNow()
Next we will get the day of week of current date, so click on the Next step and select Compose action, then in Input write the below expression:
dayOfWeek(variables('currentDate'))
Now click on Save and run the flow manually, and you can see the number of week in the output of compose action.
This is an example of Power Automate get day of week.
Read Microsoft Flow or Power Automate employee onboarding
Power automate get current day
Here we will see how to get today’s date or current date using Power Automate.
In Power Automate select the Manually triggered Flow, then click on the Next step.
To get the current date, select the Compose action and in Input write the below expression:
utcNow()
Now click on Save and run the flow manually you can see the today’s date in the output of compose action.
This is an example of Power automate get current day.
Read Convert SharePoint list item to PDF using Flow or Power Automate
Power automate get hour
Here we will see how to get hour using Power Automate.
In Power Automate select the Manually triggered flow, then click on the Next step.
Now to get the hour, select Compose action, then in Input write the below expression
formatDateTime(utcNow(),'hh:mm tt')
Now click on Save and run the flow manually, and you can see the hour in compose action.
This is an example of Power automate get hour.
Read Power Automate Create a CSV Table
Power automate get date only
Here we will see how to get date only from current date and time using Power Automate.
In Power Automate, select the Manually triggered flow, then click on the Next step.
Next to get the date only, select compose action, then in Input provide the below expression.
formatDateTime(utcNow(),'yyyy-MM-dd')
Now click on Save and run the flow, you can see the date only in the compose action.
This is an example of Power automate get date only.
Also, read, How to update SharePoint Multiselect column in Power Automate
Power Automate get first day of next month
Here we will see how to get first day of Next month using Power Automate.
In Power Automate select the Manually triggered Flow, then click on the Next step.
Now we will get the last day of current Month, so select Initialize variable action, then provide the variable name, type as string, and in value write the below expression:
addDays(concat(add(int(formatDateTime(utcNow(), 'yyyy')),if(equals(formatDateTime(utcNow(), 'MM'), '12'), 1, 0) ),'-',add(int(formatDateTime(utcNow(), 'MM')),if(equals(formatDateTime(utcNow(), 'MM'), '12'), -11, 1) ),'-01T00:00:00Z'),-1)
Next we will get the first day of next month, so click on the next step and select Compose action, then in Input provide the below expression:
addDays(variables('LastDayofCurrentMonth'),1,'yyyy-MM-dd')
Now click on Save and run the flow manually and you can see the first day of Next month.
This is an example of Power Automate get first day of next month.
Also, read How to create a word document from a template in Power Automate
Power Automate get last day of previous month
Here we will see how to get last day of previous month using Power Automate.
In Power Automate, select the Manually triggered flow, then click on the Next step.
Now we will get the current month, so select Add to time action, then provide the below expression in base time
utcNow()
Then provide the interval is 0 and provide Time unit is Month from the dropdown.
Now we will get last day of previous month, so click on the Next step and select Compose action, then in Input write the below expression:
addDays(startOfMonth(body('Add_to_time')),-1,'MM-dd-yyyy')
Now click on Save and run the flow manually, you can see the last day of previous month in the output of compose action.
This is an example of Power Automate get last day of previous month.
Related Power Automate tutorials:
- Power Automate Create File
- How to call a flow from another flow in Power Automate
- Power Automate Replace
- Power Automate Set Variable
- Power Automate update SharePoint list increment integer field
- Power Automate wait timer
In this Power Automate tutorial, we learned to Get days of a month in Power Automate. And also we discuss the below points:
- Power automate get current month name
- Power automate get previous month
- Power automate get first day of month
- Power automate get last day of month
- Power automate get previous year
- Power automate get day from date
- Power automate get day of week
- Power automate get current day
- Power automate get hour
- Power automate get date only
- Power automate get first day of next month
- Power automate get last day of previous month
After working for more than 15 years in Microsoft technologies like SharePoint, Office 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 (9 times). I have also worked in companies like HP, TCS, KPIT, etc.