Hi all, I am trying to extract a date for the last day of the previous month from the current date. I am using the addMonth -1 function with formatDate as YYYY-DD-01 for the first date of the month but that doesn’t work for the last day of the month - please point me in the right direction here?
Hey, this could cause issues as not every month might have 31st.
Try formatDate to fetch 1st of current month and subtract 1 day out of it.
Formula:
{{addDays(formatDate(now; “YYYY-MM-01”); -1)}}
Hello @Ken_Walton,
This is a formula for setting the previous month’s 1st date.
{{setDate(parseDate(addMonths(now; -1); "YYYY-MM-DD"); 1)}}
If you need to get the last day of the month and the number of days in the month is not fixed then use this as a reference.
Otherwise directly change 1 to a specific date.
2 Likes
Thank you - that worked
1 Like