@GwtIncompatible("incompatible method")
    public static long getFragmentInDays(final Calendar calendar, final int fragment) {
        return getFragment(calendar, fragment, TimeUnit.DAYS);
    }
@ GwtIncompatible ( "incompatible method" ) public static long getFragmentInDays ( final Calendar calendar , final int fragment ) { return getFragment ( calendar , fragment , TimeUnit . DAYS ) ; }
<p>Returns the number of days within the
fragment. All datefields greater than the fragment will be ignored.</p>

<p>Asking the days of any date will only return the number of days
of the current month (resulting in a number between 1 and 31). This
method will retrieve the number of days for any fragment.
For example, if you want to calculate the number of days past this year,
your fragment is Calendar.YEAR. The result will be all days of the
past month(s).</p>

<p>Valid fragments are: Calendar.YEAR, Calendar.MONTH, both
Calendar.DAY_OF_YEAR and Calendar.DATE, Calendar.HOUR_OF_DAY,
Calendar.MINUTE, Calendar.SECOND and Calendar.MILLISECOND
A fragment less than or equal to a DAY field will return 0.</p>

<ul>
<li>January 28, 2008 with Calendar.MONTH as fragment will return 28
(equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li>
<li>February 28, 2008 with Calendar.MONTH as fragment will return 28
(equivalent to calendar.get(Calendar.DAY_OF_MONTH))</li>
<li>January 28, 2008 with Calendar.YEAR as fragment will return 28
(equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li>
<li>February 28, 2008 with Calendar.YEAR as fragment will return 59
(equivalent to calendar.get(Calendar.DAY_OF_YEAR))</li>
<li>January 28, 2008 with Calendar.MILLISECOND as fragment will return 0
(a millisecond cannot be split in days)</li>
</ul>

@param calendar the calendar to work with, not null
@param fragment the {@code Calendar} field part of calendar to calculate
@return number of days within the fragment of date
@throws IllegalArgumentException if the date is <code>null</code> or
fragment is not supported
@since 2.4