Java tutorial
//package com.java2s; import java.util.Calendar; public class Main { public static int getDayOfMonth(int y, int m) { Calendar cal = Calendar.getInstance(); cal.set(y, m - 1, 1); int dateOfMonth = cal.getActualMaximum(Calendar.DATE); return dateOfMonth; } }