I’m trying to use the following code but it’s returning the wrong day of month.
Calendar cal = Calendar.getInstance(); cal.setTime(sampleDay.getTime()); cal.set(Calendar.MONTH, sampleDay.get(Calendar.MONTH)+1); cal.set(Calendar.DAY_OF_MONTH, 0); return cal.getTime();
Get the number of days for this month:
Set the Calendar to the last day of this month: