How to Get Last day of current month in Power Automate

In my previous article, I showed you how to check if today is the start date of the month in Power Automate. Subsequently I received quite a few queries on how to get the last day of a month using Power Automate.

When I first saw the question, I was kind of perplexed. I was assuming that it is kind of obvious that Power Automate must have functions to find out the last day of the month.

In my previous blog post, you will observe that I have used a function startOfMonth to get the start day of the month. On similar lines, there must be a function endOfMonth isn’t it? Well I thought so. But the fact is there is none!

But we have to achieve this. How are we going to do that? I wanted to provide a solution which shall work under all circumstances irrespective whether a month has 28/ 29/ 30 or 31 days.

So let’s get started. For this blog, I created a simple Instant cloud flow with manual trigger. The idea here is simple.

  • Get the current date
  • Add one month to the current date to get the next month.
  • Get the start date of the next month
  • Substract a day from the start date of the next month to arrive at the last day of the current month.

Sometime back, I wrote a blog post on how to get the Next and Previous month in Power Automate. Taking cue from this post, I added a month to the current date using the ‘Add to time‘ action.

Get last day of current month in Power Automate
Get last day of current month in Power Automate

As you can see, I added a month to the current date and time. To be more accurate you can use the time zone conversion action to convert it to a specific time zone, since utcNow() always returns the UTC date and time.

Now the final step. I used a string variable to get the last day of the current month.

Get last day of current month in Power Automate

A very simple and effective expression.

addDays(startOfMonth(body('NextMonth')),-1,'MM-dd-yyyy')

I use startOfMonth() function to get the starting day of the next month. Then substract one day to arrive at the last day of the current month.

Very very simple. But trust me, if you are new to Power Automate, these are the small things that may eat up your time.

And below is the result when I run the flow. As of writing this blog, today’s is 30th of March, 2021. And rightly it shows the last day of month as 31st March, 2021.

Get last day of current month in Power Automate

Hope this helped!

Debajit Dutta
Business Solutions MVP


Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe to get the latest posts sent to your email.

Discover more from Debajit's Power Apps & Dynamics 365 Blog

Subscribe now to keep reading and get access to the full archive.

Continue reading