Java Utililty Methods Month

List of utility methods to do Month

Description

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

Method

StringgetMonthEnd(String strdate)
get Month End
return strdate;
StringgetMonthFromDate(String date)
get Month From Date
int index = date.lastIndexOf("-");
return date.substring(0, index);
StringgetMonthFromYM(String ym)
get Month From YM
if (ym == null || ym.length() != DEFAULT_DATE_YM_FORMAT.length()) {
    return null;
return ym.substring(4, 6);
StringgetMonthInEnglish(int month)
get Month In English
switch (month) {
case 0:
    return "January";
case 1:
    return "February";
case 2:
    return "March";
case 3:
...
intgetMonthLastDate(int month, int year)
get Month Last Date
int lastDay;
switch (month) {
case 0:
case 2:
case 4:
case 6:
case 7:
case 9:
...
intgetMonthLength(final int year, final int month)
get Month Length
if (month == 2 && isLeapYear(year)) {
    return 29;
return DAYS_OF_MONTH[month];
intgetMonthLength(int year, int m)
get Month Length
if ((m < 1) || (m > 12)) {
    return -1;
if (isLeapYear(year)) {
    return LEAP_MONTH_LENGTH[m];
return MONTH_LENGTH[m];
intgetMonthLength(int year, int month)
get Month Length
int ml;
if ((month == 2) && (isLeapYear(year))) {
    ml = 29;
} else {
    ml = teMl[month];
return (ml);
StringgetMonthMaxDate(String str)
get Month Max Date
int month = Integer.parseInt(str.substring(5));
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
...
StringgetMonthOfNextQuarter(String yearAndMonth)
get Month Of Next Quarter
int year = Integer.parseInt(yearAndMonth.substring(0, 4));
int mon = Integer.parseInt(yearAndMonth.substring(4, 6));
String nextmonth = "";
String nextyear = String.valueOf(year);
if (mon == 10) {
    nextmonth = "01";
    nextyear = String.valueOf(year + 1);
} else if (mon == 11) {
...