I don't know if it's the quickest way, but one way would be to:
formatDateTime(addDays(parseDateTime(‘01-<month+1>-<year>’, ‘dd-MM-yyyy’), -1), ‘dd’)
So basically what you do here is:
Edit:
It's early and I forgot daysBetween exists (thanks for reminding me, Mariusz). So get the first day of next month, the first day of the month you want to know, and use the daysBetween function.