12-11-2018 03:40 PM
Hi,
I was wondering if anyone had an expression they should share to calculate last day of the month. Any help is greatly appreciated!
12-11-2018 06:27 PM
Here is an example of last day of this month. You can revise it to fit your needs.
Date.parse(Date.now().plusMonths(1).getFullYear()+“-”+Date.now().plusMonths(1).getMonth()+“-”+“01”).minusDays(1)
12-12-2018 06:35 AM
Alan,
That works great. Thank you
12-12-2018 01:19 PM
Note that you can avoid the string manipulation and use the withDayOfMonth() method to replace the current day with 1, like so:
Date.now().plusMonths(1).withDayOfMonth(1).minusDays(1)
12-12-2018 02:53 PM
Thanks, Tim! Learn something new every day.