Java Utililty Methods Month Get

List of utility methods to do Month Get

Description

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

Method

StringgetMonth(Date date)
get Month
return FormatDate(date, "MM");
intgetMonth(Date date)
get Month
Calendar cal = new GregorianCalendar();
cal.setTime(date);
int calendarMonth = cal.get(Calendar.MONTH);
return calendarMonthToInt(calendarMonth);
StringgetMonth(Date date)
get Month
DateFormat df = new SimpleDateFormat("MM");
df.setLenient(false);
String month = df.format(date);
if (month.startsWith("0"))
    return month.substring(1);
return month;
intgetMonth(Date date, TimeZone timeZone)
get Month
if (date == null)
    throw new IllegalArgumentException("date is required.");
if (timeZone == null)
    timeZone = TimeZone.getDefault();
_fmtMonth.setTimeZone(timeZone);
try {
    return Integer.parseInt(_fmtMonth.format(date));
} catch (NumberFormatException e) {
...
StringgetMonth(Date dt)
Get month string for the specified date.
SimpleDateFormat sdf = new SimpleDateFormat("MMMM");
StringBuffer sb = new StringBuffer();
sdf.format(dt, sb, new FieldPosition(0));
return sb.toString();
StringgetMonth(Date theDate)
get Month
Calendar cal = Calendar.getInstance();
cal.setTime(theDate);
int monthNum = cal.get(Calendar.MONTH);
return getMonthForInt(monthNum);
StringgetMonth(int i)
Returns the name of the month, given an int (January==0)
switch (i) {
case 0:
    return "January";
case 1:
    return "February";
case 2:
    return "March";
case 3:
...
intgetMonth(int i)
get Month
return getCurrentDate().getMonth();
StringgetMonth(int month)
get Month
String[] monthnames = new DateFormatSymbols().getMonths();
String strmonth = monthnames[month];
return strmonth;
StringgetMonth(int month)
get Month
return MONTHS[month];