How to Get the Current and Previous Month in Power Automate

A finance team I work with has a flow that runs on the first of every month, builds a report of the previous month’s expenses, and saves it as “Expenses – August 2026.xlsx”. Getting “August” out of Power Automate on September 1 takes one expression, but it has to be the right one, and it has to use the right time zone.

In this tutorial, I’ll show you the expressions for the current month’s number and name, the previous month, and the first and last day of a month. All the examples use September 27, 2026, as today’s date.

Quick answer: For the current month’s name, use formatDateTime(utcNow(), 'MMMM') (September), 'MMM' for the short name (Sep), or 'MM' for the number (09). For the previous month, use addToTime(utcNow(), -1, 'Month', 'MMMM') (August). The first day of the month is startOfMonth(utcNow()), and the last day of the previous month is addDays(startOfMonth(utcNow()), -1). utcNow() is UTC time, so convert it for US time zones.

Month formats at a glance

ExpressionResult on September 27, 2026
formatDateTime(utcNow(), 'MMMM')September
formatDateTime(utcNow(), 'MMM')Sep
formatDateTime(utcNow(), 'MM')09
formatDateTime(utcNow(), '%M')9
formatDateTime(utcNow(), 'MMMM yyyy')September 2026
formatDateTime(utcNow(), 'yyyy-MM')2026-09

Watch the capital letters: MM is the month, and mm is minutes. And don’t use a single 'M' on its own; Power Automate treats it as a built-in pattern and returns “September 27”. Use '%M' for the month number without a leading zero.

Get the current month

Create an instant cloud flow with Manually trigger a flow. Add an Initialize variable action for each value you want, or use Compose actions if you only need to read the result.

Month number

To get the number as an integer, for example to compare it or do math with it, wrap the formatted value in int(), and set the variable’s Type to Integer:

int(formatDateTime(utcNow(), 'MM'))
Initialize variable action with an Integer type and the int formatDateTime MM expression

For today, that’s 9. You can show the variable in a Compose action to check it:

Compose action showing the Current Month Number variable

Month name

For the full name, use a String variable:

formatDateTime(utcNow(), 'MMMM')
Initialize variable action with the formatDateTime MMMM expression for the month name

Today, it returns September. Give each variable its own name, such as varMonthName and varMonthShort; two variables in the same flow can’t share a name.

Short month name

formatDateTime(utcNow(), 'MMM')
Initialize variable action with the formatDateTime MMM expression for the short month name

That returns Sep. Power Automate uses US English by default, so September is “Sep”, not “Sept”. For another language, add a locale as the third argument, for example formatDateTime(utcNow(), 'MMMM', 'es-es') returns “septiembre”.

Save the flow, select Test > Manually > Test, and check the outputs in the run history.

Get the previous month

addToTime() adds or subtracts a unit of time, and it takes an optional format, so one expression does both jobs:

ExpressionResult on September 27, 2026
addToTime(utcNow(), -1, 'Month', 'yyyy-MM-dd')2026-08-27
addToTime(utcNow(), -1, 'Month', 'MMMM')August
addToTime(utcNow(), -1, 'Month', 'MMMM yyyy')August 2026
getPastTime(1, 'Month', 'MMMM')August
Initialize variable action with addToTime subtracting one month from utcNow
Initialize variable action with addToTime returning the previous month name

getPastTime(1, 'Month') is a shortcut for “one month before now.” If today is the 31st and last month has fewer days, the day is moved to the last day of that month (March 31 becomes February 28), and the month is still correct. January correctly becomes December of the previous year.

Get the first and last day of a month

startOfMonth() returns midnight on the first day of the month. Combine it with addToTime or addDays for the other boundaries:

You wantExpressionResult
First day of this monthstartOfMonth(utcNow(), 'yyyy-MM-dd')2026-09-01
First day of last monthaddToTime(startOfMonth(utcNow()), -1, 'Month', 'MMMM d, yyyy')August 1, 2026
Last day of last monthaddDays(startOfMonth(utcNow()), -1, 'dddd, MMMM d, yyyy')Monday, August 31, 2026
Last day of this monthaddDays(addToTime(startOfMonth(utcNow()), 1, 'Month'), -1, 'MM/dd/yyyy')09/30/2026
First day of next monthaddToTime(startOfMonth(utcNow()), 1, 'Month', 'yyyy-MM-dd')2026-10-01
Initialize variable action with startOfMonth and addToTime for the first day of the previous month
Initialize variable action with an expression for the last day of the previous month

The last-day trick works for every month, including February in a leap year, because it goes to the first of the next month and steps back one day. The older expression in the screenshot above wraps utcNow() in addToTime(..., 0, 'month'), which does nothing; the shorter version in the table gives the same result.

These values are handy for filters, such as getting last month’s SharePoint items with Created ge '@{addToTime(startOfMonth(utcNow()), -1, 'Month')}' and Created lt '@{startOfMonth(utcNow())}'. See Get items filter query by date for more.

Use your own time zone

utcNow() is UTC. On the evening of September 30, it’s already October in UTC for anyone in the US: at 9:00 PM Eastern, formatDateTime(utcNow(), 'MMMM') returns “October”. A report flow scheduled for the last evening of the month would pick the wrong month.

Convert to your time zone first. convertFromUtc() also takes a format:

convertFromUtc(utcNow(), 'Eastern Standard Time', 'MMMM')

For the previous month in Eastern time:

formatDateTime(addToTime(startOfMonth(convertFromUtc(utcNow(), 'Eastern Standard Time')), -1, 'Month'), 'MMMM')

Use ‘Central Standard Time’, ‘Mountain Standard Time’ or ‘Pacific Standard Time’ as needed; they handle daylight saving time. For more, see how to convert UTC to local time in Power Automate.

Common problems

  • InvalidTemplate error when initializing the variable. The type doesn’t match the value. int(...) needs an Integer variable, and formatted text needs a String.
  • The number comes out as “September 27”. You used 'M' alone. Use '%M' or int(formatDateTime(utcNow(), 'MM')).
  • Minutes instead of the month. mm is minutes; use capital MM.
  • Wrong month at the start or end of the month. It’s the UTC time zone; convert with convertFromUtc.

These Power Automate date tutorials may help next:

Frequently Asked Questions

How do I get the current month name in Power Automate?

Use formatDateTime(utcNow(), ‘MMMM’) for the full name or ‘MMM’ for the short name. Microsoft lists the date functions in its expression functions reference.

How do I get the previous month in Power Automate?

Use addToTime(utcNow(), -1, ‘Month’, ‘MMMM’) for the name, or getPastTime(1, ‘Month’, ‘MMMM’).

How do I get the last day of the previous month?

Use addDays(startOfMonth(utcNow()), -1, ‘MM/dd/yyyy’). It goes to the first of this month and steps back one day.

Why does my flow return the wrong month?

utcNow() is UTC. Late in the evening in the US, it’s already the next day, and sometimes the next month. Convert with convertFromUtc(utcNow(), ‘Eastern Standard Time’).