Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Date; public class Main { public static int getNumberOfDaysInMonth(Date someDayInMonth) { Calendar monthCal = Calendar.getInstance(); monthCal.setTime(someDayInMonth); return monthCal.getActualMaximum(Calendar.DAY_OF_MONTH); } }