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

longmonthMillis(int year, int monthNum)
month Millis
if (monthNum == 13) {
    year += 1;
    monthNum = 0;
monthNum += 1;
if (monthNum == 2) {
    if (year % 4 == 0 && year % 100 != 0 || year % 400 == 0) {
        return (long) 1000 * 60 * 60 * 24 * 29;
...
intmonthStringToInteger(String month)
Fetches the numerical month value based on the given String representation.
if (month.equalsIgnoreCase("Jan") || month.equalsIgnoreCase("January")) {
    return 0;
if (month.equalsIgnoreCase("Feb") || month.equalsIgnoreCase("February")) {
    return 1;
if (month.equalsIgnoreCase("Mar") || month.equalsIgnoreCase("March")) {
    return 2;
...
StringMonthText(int iIndex)
Month Text
String retValue = "";
switch (iIndex) {
case 1:
    retValue = "Enero";
    break;
case 2:
    retValue = "Febrero";
    break;
...
intmonthToTerm(int month)
Java months are zero-based, January = 0 thru December = 11
int term = (month / 3) + 1;
return term;
StringnextMonth(String s)
next Month
if (s.length() != 7)
    return s;
else {
    String ss[] = s.split("-");
    String res;
    int i = Integer.parseInt(ss[0]);
    i++;
    if (i < 10)
...
intnextMonthIndex(int current, int step)
next Month Index
return nextCircularIndex(current, step, 12);
intnormalizeMonth(final int month)
normalize Month
if (1 <= month && month <= 12)
    return month;
int modulo = month % 12;
if (modulo < 0)
    return 12 + modulo;
return modulo == 0 ? 12 : modulo;
StringnormalizeMonth(String word)
normalize Month
if (isReserved(word))
    return word;
if (isMonth(word))
    return "*MONTH*";
return word;
intparaseMonth(String yearMonth)
parase Month
String month = yearMonth.substring(4);
return Integer.parseInt(month);
StringparseMonth(final int month)
Parse month number to string.
String monthString = "";
switch (month) {
case 0:
    monthString = "Enero";
    break;
case 1:
    monthString = "Febrero";
    break;
...