Java Calendar Month numberOfDaysInMonth(Calendar cal)

Here you can find the source of numberOfDaysInMonth(Calendar cal)

Description

number Of Days In Month

License

Apache License

Declaration

private static int numberOfDaysInMonth(Calendar cal) 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.util.Calendar;

public class Main {
    private static int numberOfDaysInMonth(Calendar cal) {
        cal.set(Calendar.DAY_OF_MONTH, 1);
        cal.set(Calendar.HOUR, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MILLISECOND, 0);
        cal.add(Calendar.MONTH, 1);
        cal.add(Calendar.DAY_OF_MONTH, -1);
        return cal.get(Calendar.DAY_OF_MONTH);
    }/*from  w w w . j a v  a  2s .c om*/
}

Related

  1. intToCalendarMonth(int month)
  2. isFirstDayOfMonth(Calendar calendar)
  3. lastDayOfMonth(Calendar c)
  4. month(Calendar calendar)
  5. month(Calendar date)
  6. sameMonth(Calendar one, Calendar two)
  7. setDate(Calendar cal, int month, int date)
  8. setDate(Calendar cal, int month, int date, boolean endOfDay)
  9. setDate(Calendar calendar, int month, int date)