Here you can find the source of getNumberOfDays(int year, int month)
Parameter | Description |
---|---|
year | a parameter |
month | a parameter |
public static int getNumberOfDays(int year, int month)
//package com.java2s; import java.util.Calendar; import java.util.GregorianCalendar; public class Main { /**/*from www . j a v a2s . com*/ * Returns the number of days in the provided month and year. * @param year * @param month * @return number of days in month */ public static int getNumberOfDays(int year, int month) { Calendar calendar = new GregorianCalendar(year, month, 1); return calendar.getActualMaximum(Calendar.DAY_OF_MONTH); // 28 } }