endOfMonth(date) { ; get current month and year FormatTime, date, %date%, yyyyMM StringRight, month, date, 2 FormatTime, year, %date%, yyyy ; select first day of the following month If month < 12 { month++ If month < 10 ; add leading zero month = 0%month% date = %year%%month%01 } Else { year++ date = %year%0101 } ; select last day of actual month date += -1, Days ; return date Return date }I've run a few tests and it seems to work fine - still, if you find any bugs, please let me know.
PS: If you can think of a better (more telling) name for this function, please let me know; proper naming of functions and variables is very important to me...