Java Utililty Methods Date to Month

List of utility methods to do Date to Month

Description

The list of methods to do Date to Month are organized into topic(s).

Method

intgetMonth(Date date)
get Month
Calendar calendar = getCalendarFromDate(date);
return calendar.get(Calendar.MONTH) + 1;
intgetMonth(Date date)
get Month
Calendar cld = Calendar.getInstance();
cld.setTime(date);
return cld.get(Calendar.MONTH) + 1;
intgetMonth(Date date)
get Month
return newCalendar(date).get(Calendar.MONTH);
intgetMonth(Date date)
get Month
return getCalendar(date).get(2);
intgetMonth(Date date)
Returns a int value indicating the number of the month.
return parseDateToCalendar(date).get(Calendar.MONTH);
intgetMonth(Date date)
get Month
Calendar cal = new GregorianCalendar();
cal.setTime(date);
int calendarMonth = cal.get(Calendar.MONTH);
return calendarMonthToInt(calendarMonth);
intgetMonth(Date dateParam)
get Month
if (dateParam == null) {
    throw new IllegalArgumentException("The dateParam  must not be null");
Calendar cal = Calendar.getInstance();
cal.setTimeInMillis(dateParam.getTime());
return cal.get(Calendar.MONTH) + 1;
StringgetMonth(Date... objects)
get Month
Date date = null;
date = (objects.length > 0) ? objects[0] : new Date();
Calendar cal = GregorianCalendar.getInstance();
cal.setTime(date);
String month = String.valueOf(cal.get(Calendar.MONDAY) + 1);
month = (month.length() < 2) ? "0" + month : month;
return month;
intgetMonth(java.util.Date date)
get Month
java.util.Calendar c = java.util.Calendar.getInstance();
c.setTime(date);
return c.get(java.util.Calendar.MONTH) + 1;
java.util.Date[]getMonth(java.util.Date date)
get Month
java.util.Calendar cal = java.util.Calendar.getInstance();
cal.setTime(date);
int lastDay = cal.getActualMaximum(java.util.Calendar.DAY_OF_MONTH);
cal.set(java.util.Calendar.DAY_OF_MONTH, 1);
java.util.Date begin = cal.getTime();
cal.set(java.util.Calendar.DAY_OF_MONTH, lastDay);
java.util.Date end = cal.getTime();
return new java.util.Date[] { begin, end };
...