Here you can find the source of daysInMonth(GregorianCalendar c)
Parameter | Description |
---|---|
c | GregorianCalendar |
public static int daysInMonth(GregorianCalendar c)
//package com.java2s; import java.util.*; public class Main { /**/* ww w .ja v a2 s. c o m*/ * MONTH */ public static final int MONTH = 2; /** * YEAR */ public static final int YEAR = 3; /** * Here get the number of days in particular month * * @param c GregorianCalendar * * @return int Number of days in particular month */ public static int daysInMonth(GregorianCalendar c) { int[] daysInMonths = { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 }; daysInMonths[1] += c.isLeapYear(c.get(GregorianCalendar.YEAR)) ? 1 : 0; return daysInMonths[c.get(GregorianCalendar.MONTH)]; } }