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

StringlookupMonthStr(int month)
lookup Month Str
return (month < 0 || month > MONTHS_STR.length) ? null : MONTHS_STR[month];
intmaxLengthOfMonth(int month)
max Length Of Month
switch (month) {
case 2: 
    return 29;
case 4: 
case 6: 
case 9: 
case 11: 
    return 30;
...
longMONTH(int mh)
MONTH
return mh * 30 * 24 * 60 * 60 * 1000;
intmonth2int(String month)
Parse a String and determine if it is a month.
int result = 0;
if (month != null) {
    if (month.equalsIgnoreCase("january")) {
        result = 0;
    } else if (month.equalsIgnoreCase("february")) {
        result = 1;
    } else if (month.equalsIgnoreCase("march")) {
        result = 2;
...
intmonth2second(int month)
monthsecond
return month * 30 * 24 * 3600;
Stringmonth2String(int month)
Examine an int and determine if it is a month.
String result = "January";
if (month == 0) {
    result = "January";
} else if (month == 1) {
    result = "February";
} else if (month == 2) {
    result = "March";
} else if (month == 3) {
...
StringmonthAlphaToNum(String str)
Month string to number
str = str.toLowerCase();
if (str.equals("jan") || str.equals("january")) {
    return "01";
} else if (str.equals("feb") || str.equals("february")) {
    return "02";
} else if (str.equals("mar") || str.equals("march")) {
    return "03";
} else if (str.equals("apr") || str.equals("april")) {
...
intmonthDiff(String beforeTime, String endTime)
month Diff
if (beforeTime == null || endTime == null) {
    return 0;
int beforeYear, endYear, beforeMonth, endMonth;
try {
    beforeYear = Integer.parseInt(beforeTime.substring(0, 4));
    endYear = Integer.parseInt(endTime.substring(0, 4));
    beforeMonth = Integer.parseInt(beforeTime.substring(5, 7)) - 1;
...
intmonthFromDateValue(long x)
Get the month from a date value.
return (int) (x >>> SHIFT_MONTH) & 15;
intmonthLength(int year, int month)
count of days in the given month (one indexed) of the given year.
switch (month) {
case 1:
case 3:
case 5:
case 7:
case 8:
case 10:
case 12:
...