List of utility methods to do Month of Year
int | getLastMonthOfQuater(Date date) get Last Month Of Quater Calendar calendar = Calendar.getInstance(); calendar.setTime(date); Date lastDayOfQuarter = getLastDayOfQuarter(calendar.get(Calendar.YEAR), getQuarterOfYear(date)); int quarter = getQuarterOfYear(date); calendar.setTime(lastDayOfQuarter); int i = calendar.get(Calendar.MONTH) + 1; return i; |
int | getLastMonthOfYear() get Last Month Of Year Calendar cal = Calendar.getInstance(); cal.add(Calendar.MONTH, 0); int lastmonth = cal.get(Calendar.MONTH); return lastmonth; |
int | getMaxDayOfMonth(int year, int month) get Max Day Of Month if (month == 1 && isLeapYear(year)) { return 29; return DAY_OF_MONTH[month]; |
int | getMonth(int week, int year) Gets the month. Calendar cal = getFirstSundayDateInYear(year);
cal.add(Calendar.DAY_OF_YEAR, (week - 1) * 7);
return cal.get(Calendar.MONTH);
|
int | getMonthDays(Object year, Object month) get Month Days Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, Integer.parseInt(year.toString()));
cal.set(Calendar.MONTH, Integer.parseInt((month.toString())) - 1);
return cal.getActualMaximum(Calendar.DAY_OF_MONTH);
|
int | getMonthHaveDays(int year, int month) get Month Have Days Calendar cal = Calendar.getInstance();
cal.set(year, month - 1, 1);
return cal.getActualMaximum(Calendar.DATE);
|
String | getMonthOfYear(int m) get Month Of Year if (m == 0) { return "Jan"; } else if (m == 1) { return "Feb"; } else if (m == 2) { return "Mar"; } else if (m == 3) { return "Apr"; ... |
int | getMonthOfYear(long time) get Month Of Year return (int) (getTotalMonths(time) % monthsInYear); |
int | getMonthOfYearFromTimestamp(long ms) get Month Of Year From Timestamp if (ms < 0) throw new NumberFormatException("argument must be positive"); Calendar cal = Calendar.getInstance(TIMEZONE, LOCALE); cal.setTimeInMillis(ms); return cal.get(Calendar.MONTH); |
Date | getMonthStart(int year, int month) Get the beginning time of a month Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, year);
cal.set(Calendar.MONTH, month);
cal.set(Calendar.DATE, 1);
cal.set(Calendar.HOUR_OF_DAY, 0);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.SECOND, 0);
return cal.getTime();
...
|