List of utility methods to do Day of Month
Date | getLastDayOfMonth(Date date) get Last Day Of Month Calendar calendar = Calendar.getInstance();
calendar.setTime(date);
calendar.set(calendar.get(Calendar.YEAR), calendar.get(Calendar.MONTH), 1);
calendar.roll(Calendar.DATE, -1);
return calendar.getTime();
|
String | getLastDayOfMonth(Date date) get Last Day Of Month Calendar cal = Calendar.getInstance();
cal.setTime(date);
cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DATE));
return date2String(cal.getTime());
|
Date | getLastDayOfMonth(Date date) get Last Day Of Month Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DATE, 1);
c.add(Calendar.MONTH, 1);
c.add(Calendar.DATE, -1);
date = c.getTime();
return date;
|
Date | getLastDayOfMonth(Date date) This method is used for getting the last day of the month Calendar c = Calendar.getInstance();
c.setTime(date);
c.set(Calendar.DATE, c.getActualMaximum(Calendar.DAY_OF_MONTH));
return c.getTime();
|
Date | getLastDayOfMonth(Date dt) Get last day of month (2007-01-12 = 2007-01-31) if (null == dt) { return null; Calendar calendar = Calendar.getInstance(); calendar.setTime(dt); int day = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); Calendar rtnCalendar = Calendar.getInstance(); rtnCalendar.clear(); ... |
int | getLastDayOfMonth(Date firstDate) get Last Day Of Month Calendar cal = Calendar.getInstance();
cal.setTime(firstDate);
return cal.getActualMaximum(Calendar.DATE);
|
Date | getLastDayOfMonth(Date now) get Last Day Of Month Calendar cal = Calendar.getInstance(); cal.setTime(now); cal.set(Calendar.DAY_OF_MONTH, 1); cal.set(Calendar.HOUR_OF_DAY, 23); cal.set(Calendar.MINUTE, 59); cal.set(Calendar.SECOND, 59); cal.set(Calendar.MILLISECOND, 999); cal.add(Calendar.MONTH, 1); ... |
Date | getLastDayOfMonth(Date sDate) get Last Day Of Month Calendar cDay = Calendar.getInstance();
cDay.setTime(sDate);
int lastDay = cDay.getActualMaximum(Calendar.DAY_OF_MONTH);
Date lastDate = cDay.getTime();
lastDate.setDate(lastDay);
lastDate.setHours(23);
lastDate.setMinutes(59);
lastDate.setSeconds(59);
...
|
Date | getLastDayOfMonth(final Date date) get Last Day Of Month Calendar src = Calendar.getInstance();
src.setTime(date);
Calendar dst = getLastDayOfMonth(src);
return dst.getTime();
|
Calendar | getLastdayOfMonth(int month, int year) get Lastday Of Month Calendar cal = Calendar.getInstance(); int days = 30; if (month == 1 || month == 3 || month == 5 || month == 7 || month == 8 || month == 10 || month == 12) { days = 31; } else if (month == 2) { days = 28; cal.set(Calendar.DAY_OF_MONTH, days); ... |