Hello everyone!
On occasion, we will get a question from a customer whose answer might be really valuable to everyone. I have tagged this as a TIL, or Today I Learned.
If you need to determine how many days are in a month, try this simple custom function. Thanks to @SenseTalkDoug for the solution.
put daysInMonth(2023,1) --> 31 days
put daysInMonth(2023,2) --> 28 days
put daysInMonth(2023,9) --> 30 days
put daysInMonth(2024,2) --> 29 days
to handle daysInMonth year, month
set firstDate to !"[[year]]-[[month]]-01" as date
put firstDate + 1 month into nextMonth
return (nextMonth - firstDate) as days
end daysInMonth