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

StringgetFirstMonthOfQuarter(String quarter)
get First Month Of Quarter
int qu = Integer.parseInt(quarter);
String month = "";
if (qu == 1) {
    month = "01";
} else if (qu == 2) {
    month = "04";
} else if (qu == 3) {
    month = "07";
...
intgetFiscalMonth(int month, int fiscalMonthOffset)
get Fiscal Month
int result = ((month - fiscalMonthOffset - 1) % 12) + 1;
if (result < 0) {
    result += 12;
return result;
StringgetFrontMonth(String month)
get Front Month
int mon = Integer.parseInt(month);
String frontmonth = "";
if (mon == 1) {
    frontmonth = "12";
} else if (mon < 11) {
    frontmonth = "0" + String.valueOf(mon - 1);
} else {
    frontmonth = String.valueOf(mon - 1);
...
StringgetMonthBegin(String strdate)
get Month Begin
return strdate;
StringgetMonthBeginByMonth(String month)
get Month Begin By Month
return month + "-01";
StringgetMonthBetween(String strDate, int intDiff)
get Month Between
try {
    int intYear = Integer.parseInt(strDate.substring(0, 4));
    int intMonth = Integer.parseInt(strDate.substring(4, 6));
    String strDay = "";
    if (strDate.length() > 6)
        strDay = strDate.substring(6, strDate.length());
    for (intMonth += intDiff; intMonth <= 0; intMonth += 12)
        intYear--;
...
StringgetMonthByDate(String yyyyMMdd)
get Month By Date
return yyyyMMdd.substring(0, 6);
IntegergetMonthCountByBillMode(String billMode)
Description Get month count by bill mode.
Integer monthCount = null;
if ("Y".equals(billMode) || "A".equals(billMode)) {
    monthCount = 12;
} else if ("S".equals(billMode)) {
    monthCount = 6;
} else if ("Q".equals(billMode)) {
    monthCount = 3;
} else if ("M".equals(billMode)) {
...
StringgetMonthDescription(int month)
get Month Description
return getMonthDescription(month, 0);
intgetMonthDiff(String startDate, String endDate)
get Month Diff
String[] startArray = startDate.split("-");
String[] endArray = endDate.split("-");
int startYear = Integer.parseInt(startArray[0]);
int startMonth = Integer.parseInt(startArray[1]);
int endYear = Integer.parseInt(endArray[0]);
int endMonth = Integer.parseInt(endArray[1]);
return Math.abs((endYear - startYear) * 12 + endMonth - startMonth);