List of utility methods to do Day of Month
Date | getLastDayOfMonth(int year, int month) get Last Day Of Month Calendar c = Calendar.getInstance(); c.set(Calendar.YEAR, year); c.set(Calendar.MONTH, month - 1); c.set(Calendar.DAY_OF_MONTH, c.getActualMaximum(Calendar.DAY_OF_MONTH)); c.set(Calendar.HOUR, 0); c.set(Calendar.MINUTE, 0); c.set(Calendar.SECOND, 0); c.set(Calendar.MILLISECOND, 0); ... |
String | getLastDayOfMonth(int year, int month) get Last Day Of Month Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month - 1); cal.set(Calendar.DAY_OF_MONTH, 1); int value = cal.getActualMaximum(Calendar.DAY_OF_MONTH); cal.set(Calendar.DAY_OF_MONTH, value); StringBuffer sb = new StringBuffer(); String date = new SimpleDateFormat("yyyy-MM-dd").format(cal.getTime()); ... |
String | getLastDayOfMonth(int year, int month) get the last date of given month and year Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DATE, 1); calendar.add(Calendar.MONTH, 1); calendar.add(Calendar.DAY_OF_YEAR, -1); return calendar.get(Calendar.YEAR) + "-" + (calendar.get(Calendar.MONTH) + 1) + "-" + calendar.get(Calendar.DAY_OF_MONTH); ... |
String | getLastDayOfMonth(int year, int month) get Last Day Of Month Calendar c = Calendar.getInstance(); c.set(year, month, 1, 0, 0, 0); c.add(Calendar.MONTH, -1); c.set(Calendar.DAY_OF_MONTH, c.getMaximum(Calendar.DAY_OF_MONTH)); SimpleDateFormat sdf = new SimpleDateFormat(FORMAT); return sdf.format(c.getTime()); |
Integer | getLastDayOfMonth(int year, int month) get Last Day Of Month return intDateSub(getIntDate(newCalendar(year, month + 1, 1)), 1);
|
String | getLastDayOfMonth(int year, int month) get Last Day Of Month int m = month; if (m > 12) m = 12; if (m < 1) m = 1; Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, m - 1); ... |
int | getLastDayOfMonth(int year, int month) get Last Day Of Month Calendar calendar = Calendar.getInstance(); calendar.set(Calendar.YEAR, year); calendar.set(Calendar.MONTH, month - 1); calendar.set(Calendar.DAY_OF_MONTH, 1); int value = calendar.getActualMaximum(Calendar.DAY_OF_MONTH); calendar.set(Calendar.DAY_OF_MONTH, value); return calendar.get(Calendar.DAY_OF_MONTH); |
Date | getLastDayOfMonth(int year, int month) Return last day of date with specified year and month Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, year); cal.set(Calendar.MONTH, month); int lastDay = cal.getActualMaximum(Calendar.DATE); cal.set(Calendar.DAY_OF_MONTH, lastDay); return cal.getTime(); |
java.util.Date | getLastDayOfMonth(java.util.Date date) getLastDayOfMonth: returns the last day of the given dates month date = addMonths(date, 1);
return addDays(getFirstDayOfMonth(date), -1);
|
String | getLastDayOfMonth(String year, String month) get last day of month Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, Integer.parseInt(year));
cal.set(Calendar.MONTH, Integer.parseInt(month) - 1);
cal.set(Calendar.DATE, 1);
cal.add(Calendar.MONTH, 1);
cal.add(Calendar.DATE, -1);
return String.valueOf(cal.get(Calendar.DAY_OF_MONTH));
|