chetan chetan - 3 months ago 14
Java Question

Find the number of days in a month in Java

How do you find the number of days in a month in Java?

Answer

Set the year and month on a Calendar object and then use getActualMaximum to return the last day:

calendar.getActualMaximum(Calendar.DAY_OF_MONTH)