List of utility methods to do Month Calculate
String | getCurrentMonthName() get Current Month Name return MONTH_NAMES[getCurrentMonth() - 1];
|
Date | getDateMonthShift(int Shift) get Date Month Shift Calendar tempcalendar = GregorianCalendar.getInstance();
tempcalendar.setTime(gamedate);
tempcalendar.add(Calendar.MONTH, Shift);
return tempcalendar.getTime();
|
int | getDiffInMonths(Date firstDate, Date lastDate) get Diff In Months Calendar cFirst = new GregorianCalendar(); cFirst.setTime(firstDate); Calendar cLast = new GregorianCalendar(); cLast.setTime(lastDate); int cFirst_year = cFirst.get(Calendar.YEAR); int cFirst_month = cFirst.get(Calendar.MONTH); int cLast_year = cLast.get(Calendar.YEAR); int cLast_month = cLast.get(Calendar.MONTH); ... |
String | getDisplayMonth(int month) get Display Month return monthStrings[month];
|
int | getIntMonthShift(Date Shift) get Int Month Shift Calendar tempcalendar1 = GregorianCalendar.getInstance(); Calendar tempcalendar2 = GregorianCalendar.getInstance(); tempcalendar1.setTime(Shift); tempcalendar2.setTime(gamedate); int month1 = tempcalendar1.get(Calendar.MONTH); int month2 = tempcalendar2.get(Calendar.MONTH); month1 = month1 + 12 * (tempcalendar1.get(Calendar.YEAR) - tempcalendar2.get(Calendar.YEAR)); return month1 - month2; ... |
int | getlastDateofThisMonth() getlast Dateof This Month return getlastDateofThisMonth(-1, -1);
|
Date | getLastMonthBegin() get Last Month Begin Calendar calendar = Calendar.getInstance();
calendar.add(Calendar.MONTH, -1);
calendar.set(Calendar.DAY_OF_MONTH, 1);
calendar.set(Calendar.HOUR_OF_DAY, 0);
calendar.set(Calendar.MINUTE, 0);
calendar.set(Calendar.SECOND, 0);
calendar.set(Calendar.MILLISECOND, 0);
return calendar.getTime();
...
|
String | getMonthFormat(String date) get Month Format date = deleteDash(date); return (date.substring(0, 4) + "-" + date.substring(4, 6)); |
List | getMonthlyIntervals(Date start, Date end) get Monthly Intervals List<Date> intervals = new ArrayList<Date>(); GregorianCalendar c = new GregorianCalendar(); c.setTime(start); int startMonth = c.get(Calendar.MONTH); int year = c.get(Calendar.YEAR); int month = startMonth; intervals.add(start); while (true) { ... |
String | getMonthNumber() get Month Number Calendar calendar = new GregorianCalendar(); int m = calendar.get(GregorianCalendar.MONTH); String month = new Integer(m + 1).toString(); if (month.length() < 2) month = "0" + month; return month; |