cancel
Showing results for 
Search instead for 
Did you mean: 

Get Last Day of a Month

We need a function to get in a simple way the last day of a month.

 

Today I do this by using below functions and works, but is so complex:

 

"@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)"

 

A function like startOfMonth would be amazing.

 

Regards,

 

Gustavo Moraes

Status: Under Review

This is a great idea, thank you!

Comments
Power Automate Staff
Status changed to: Under Review

This is a great idea, thank you!

+1

@Stephen 

We have a use case for this to present to our customers.

When can we expect this change to rollout?

Level: Power Up

@sandeepnmenon 

 

There is now a startOfMonth function. To get the last day of the current month, you can simply use:

 

subtractFromTime(startOfMonth(addToTime(utcNow(),1,'month')),1,'day')

 

This adds a month to the current day, jumps to the first day of the next month, then subtracts a day to be at the last day of the current month.