Add one month to date, but keep exact same day or last day of the month if higher
Hello.
I have the following requirement: for a given DateTime, I need to get the same date + one month. However, if the day is, for example, the 31st, and the following month has only 30 days or less, I need it be the last day of the following month.
I could have use a function to add days and add 30 days to the current date, or use an existing function to add one month, but I'm affraid the date could shift on the next month (like changing from 26 to 25 of the month).
In practice, these are some example of results I'd like to have:
26/06->26/07->26/08...
01/06->01/07->01/08...
31/05->30/06->31/07...
30/06->30/07->30/08...
Is there an ootb existing function for this? Or do I need to use java code or activity for this?
Thanks in advance.