How to get days of month in Power Automate + 15 Examples

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.

power automate get the days of the month
power automate get the days of the month

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.

get the days of the month power automate
get the days of the month power automate

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'))
get the days of the month MS flow
get the days of the month MS flow

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'))
get the days of the month Microsoft flow
get the days of the month Microsoft flow

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))
get the days of the month in Microsoft flow
get the days of the month in Microsoft flow

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'))
Microsoft flow get the days of the month
Microsoft flow get the days of the month

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.

MS flow get the days of the month
MS flow get the days of the 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.

MS flow get current month name
MS flow get current month name

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')
power automate get current month name
power automate get current month name

Now click on Save and run the Flow manually you can see the current month in Power Automate.

Microsoft Flow get current month name
Microsoft Flow get current month name

This is an example of Power automate get current month name.

Read Power Automate Compose

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.

 get previous month using power automate
get previous month using power automate

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.

power automate get previous month
power automate get 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.

MS Flow get previous month
MS Flow get previous month

Now click on Save and run the flow manually, and you can see the Previous Month name.

 get previous month in MS Flow
get a previous month in MS Flow

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.

 get first day of month power automate
get first day of month power automate

Next, select a Compose action, then in Input write the below expression to calculate the first day of the month.

formatDateTime(startOfMonth(utcNow()),'dddd') 
power automate get first day of month
power automate get the first day of the month

Now click on Save and run the flow manually, you can see the result first day of the month.

Microsoft Flow get first day of month
Microsoft Flow get first day of 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.

power automate get last day of month
power automate get last day of month

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.

power automate get last day of month
power automate get last day of the 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')
How power automate get last day of month
How power automate get last day of month

Now click on Save and run the flow manually, and you can see the last day of the current month.

Microsoft Flow get last day of month 1
Microsoft Flow get last day of 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.

power automate get previous year
power automate get previous year

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')
power automate get previous year
power automate get previous year

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)
Microsoft Flow get previous year
Microsoft Flow get previous year

Now click on Save and run the flow manually and you can see the previous year in the output of compose action.

MS Flow get previous year
MS Flow get previous year

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.

Power automate get day from date
Power automate get day from date

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')
Microsoft Flow get day from date
Microsoft Flow get day from date

Now click on Save and run the Flow manually, you can see the day in the below screenshot.

MS Flow get day from date
MS Flow get day from date

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.

power automate get day of week
power automate get day of week

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()
MS Flow get day of week
MS Flow get day of week

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'))
Microsoft Flow get day of week
Microsoft Flow get day of week

Now click on Save and run the flow manually, and you can see the number of week in the output of compose action.

get day of week using Microsoft Flow
get day of week using Microsoft Flow

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.

Power automate get current day
Power automate get current day

To get the current date, select the Compose action and in Input write the below expression:

utcNow()
Power automate get current day
Power automate get current day

Now click on Save and run the flow manually you can see the today’s date in the output of compose action.

Microsoft Flow get current day
Microsoft Flow get current day

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.

Power automate get hour
Power automate get hour

Now to get the hour, select Compose action, then in Input write the below expression

formatDateTime(utcNow(),'hh:mm tt')
Microsoft Flow get hour
Microsoft Flow get hour

Now click on Save and run the flow manually, and you can see the hour in compose action.

MS Flow get hour
MS Flow get hour

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.

Power automate get date only
Power automate get date only

Next to get the date only, select compose action, then in Input provide the below expression.

formatDateTime(utcNow(),'yyyy-MM-dd')
MS flow get date only
MS flow get date only

Now click on Save and run the flow, you can see the date only in the compose action.

Microsoft flow get date only
Microsoft flow get date only

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.

power automate get first day of next month
power automate get first day of next month

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)
Microsoft Flow get first day of next month
Microsoft Flow get first day of next month

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')
MS Flow get first day of next month
MS Flow get first day of next month

Now click on Save and run the flow manually and you can see the first day of Next month.

get first day of next month using MS Flow
get first day of next month using MS Flow

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.

power automate get last day of previous month
power automate get last day of previous month

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.

Microsoft Flow get last day of previous month
Microsoft Flow get last day of previous month

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')
MS Flow get last day of previous month
MS Flow get last day of previous month

Now click on Save and run the flow manually, you can see the last day of previous month in the output of compose action.

get last day of previous month using MS Flow
get last day of previous month using MS Flow

This is an example of Power Automate get last day of previous month.

Related Power Automate tutorials:

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
>