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.
This is a great idea, thank you!
We have a use case for this to present to our customers.
When can we expect this change to rollout?
There is now a startOfMonth function. To get the last day of the current month, you can simply use:
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.
Big thanks to @leep The formula you posted is exactly what I needed to calculate the end of the month. Thank you!!! 😊
[edited for additional clarity]
I'm a little confused by the need for a specific function for this. I was able to determine if today is the last day of the month with the following: