Calendar cal = Calendar.getInstance(); int lastDayOfMonth = cal.getActualMaximum(Calendar.DAY_OF_MONTH); System.out.println(lastDayOfMonth);