How to get number of days in month java code, Examples?
public static int getNoOfDays(int month, int year){
Calendar calendar = Calendar.getInstance();
int date = 1;
calendar.set(year, month, date);
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
return days;
}
Calendar calendar = Calendar.getInstance();
int date = 1;
calendar.set(year, month, date);
int days = calendar.getActualMaximum(Calendar.DAY_OF_MONTH);
return days;
}
Comments
Post a Comment