Here you can find the source of getDaysOfMonth(Date date)
public static int getDaysOfMonth(Date date)
//package com.java2s; //License from project: Open Source License import java.util.Calendar; import java.util.Date; public class Main { private static final Calendar calendar = Calendar.getInstance(); public static int getDaysOfMonth(Date date) { calendar.setTime(date);/*from w ww . j a v a 2 s .c om*/ return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); } }