Java tutorial
//package com.java2s; import java.util.Calendar; import java.util.Locale; public class Main { public static int getNumberOfWeeksInMonth(int year, int month) { Calendar calendar = Calendar.getInstance(Locale.FRANCE); calendar.set(year, month, 1, 0, 0, 0); calendar.set(Calendar.MILLISECOND, 0); return calendar.getActualMaximum(Calendar.WEEK_OF_MONTH); } }