Given a YearMonth
(from org.joda.time.YearMonth
), is there a easy way to get the number of days in that month?
I saw this thread Number of days in particular month of particular year? and it works fine with the following.
- Create a
Calendar
object - Call
getActualMaximum
withCalendar.DAY_OF_MONTH
Like this:
YearMonth yearMonth = new YearMonth();
Calendar cal = new GregorianCalendar(yearMonth.getYear(), yearMonth.getMonthOfYear(), 1);
int daysInMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
But I am wondering if there is some utility function in joda that I can just get the days in month directly?