OakvilleWork OakvilleWork - 1 year ago 94
Java Question

last day of month calculation

I am having issues with the calculation of when the next Last Day of the Month is for a notification which is scheduled to be sent.

Here is my code:

RecurrenceFrequency recurrenceFrequency = notification.getRecurrenceFrequency();
Calendar nextNotifTime = Calendar.getInstance();

This is the line causing issues I believe:


How can I use the Calendar to properly set the last day of the next month for the notification?

Answer Source


This returns actual maximum for current month. For example it is February of leap year now, so it returns 29.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download